20200701--iOS之分享UIActivityViewController类

Class

UIActivityViewController

A view controller that you use to offer standard services from your app.

      --一个视图控制器,你用它从你的应用程序中提供标准服务,例如邮件,连接、复制、粘贴、分享等系统服务。

           应该是可以通过该VC与Activity结合实现自定义的分享页面的,具体我还不知道怎么操作,慢慢再搞了,用系统默认的吧


 

Declaration        --声明

class UIActivityViewController : UIViewController

Overview            --概览

The system provides several standard services, such as copying items to the pasteboard, posting content to social media sites, sending items via email or SMS, and more. Apps can also define custom services.

        --该系统提供了几种标准的服务,比如将内容复制到纸板上、将内容发布到社交媒体网站、通过电子邮件或短信发送内容等等。应用程序也可以定义定制服务。

Your app is responsible for configuring, presenting, and dismissing this view controller. Configuration for the view controller involves specifying the data objects on which the view controller should act. (You can also specify the list of custom services your app supports.) When presenting the view controller, you must do so using the appropriate means for the current device. On iPad, you must present the view controller in a popover. On iPhone and iPod touch, you must present it modally.

        --您的应用程序负责配置、呈现和解除此视图控制器。视图控制器的配置包括指定视图控制器应该对其执行操作的数据对象。(您还可以指定应用程序支持的自定义服务列表。)当呈现视图控制器时,你必须为当前设备使用适当的方法。在iPad上,你必须在弹窗中呈现视图控制器。在iPhone和iPod touch上,你必须以模式方式呈现它。

 

Topics         --专题

Initializing the Activity View Controller          --初始化活动VC,这个比较重要

init(activityItems: [Any], applicationActivities: [UIActivity]?)

Initializes and returns a new activity view controller object that acts on the specified data.

--你要在这里传入分享的服务和分享的东西(item)作为构造器的参数。

class UIActivityItemsConfiguration

A configuration that allows a responder to export data through a variety of interactions.

      --一个 允许响应器通过各种交互导出数据的 配置类。

protocol UIActivityItemsConfigurationReading

 

Accessing the Completion Handler         --访问处理完成后的程序

var completionWithItemsHandler: UIActivityViewController.CompletionWithItemsHandler?

The completion handler to execute after the activity view controller is dismissed.

     --activity视图控制器被解散后执行的完成处理程序。

 

var completionHandler: UIActivityViewController.CompletionHandler?

The completion handler to execute after the activity view controller is dismissed.

Deprecated

 

Excluding Specific Activity Types         --不被显示的服务类型数组

var excludedActivityTypes: [UIActivity.ActivityType]?

The list of services that should not be displayed.

     --不被显示的服务列表。

 

Constants        --常量

typealias UIActivityViewController.CompletionWithItemsHandler

A completion handler to execute after the activity view controller is dismissed.

      --activity视图控制器被解散后执行的完成处理程序。

typealias UIActivityViewController.CompletionHandler

A completion handler to execute after the activity view controller is dismissed.

      --activity视图控制器被解散后执行的完成处理程序。

 

Relationships      --继承关系

Inherits From

Conforms To

See Also

Activities Interface

class UIActivityItemProvider

A proxy for data passed to an activity view controller.

protocol UIActivityItemSource

A set of methods used by an activity view controller to retrieve the data items to act on.

class UIActivity

An abstract class that you subclass to implement app-specific services.

 

构造方法解析:

Initializer

init(activityItems:applicationActivities:)

Initializes and returns a new activity view controller object that acts on the specified data.

      --初始化并返回一个新的activity view controller对象,该对象作用于指定的数据。

Declaration       --声明

init(activityItems: [Any], 
applicationActivities: [UIActivity]?)

Parameters        --参数

activityItems       --参数一

The array of data objects on which to perform the activity. The type of objects in the array is variable and dependent on the data your application manages. For example, the data might consist of one or more string or image objects representing the currently selected content.

         --要在VC上执行活动的数据对象数组。数组中的对象类型是可变的,取决于你的app管理的数据。例如,数据可能由一个或多个表示当前选择内容的字符串或图像对象组成

Instead of actual data objects, the objects in this array can be objects that adopt the UIActivityItemSource protocol, such as UIActivityItemProvider objects. Source and provider objects act as proxies for the corresponding data in situations where you do not want to provide that data until it is needed. Note that you should not reuse an activity view controller object that includes a UIActivityItemProvider object in its activityItems array.

     --这个数组中的对象可以是遵循UIActivityItemSource协议的对象,比如UIActivityItemProvider对象,而不是实际的数据对象。如果在需要时才提供数据,则源和provider objects充当相应数据的代理。注意,您不应该复用在activityItems数组中包含UIActivityItemProvider对象的activity VC

This array must not be nil and must contain at least one object.

    --这个数组不能是nil,必须包含至少一个对象。

applicationActivities        --参数二

An array of UIActivity objects representing the custom services that your application supports. This parameter may be nil.

        --一个表示你的应用程序支持的定制服务的UIActivity对象数组。这个参数可以是nil。

 

Return Value        --返回值

The activity view controller to present.

 

Discussion

It is your responsibility to present and dismiss the view controller using the appropriate means for the given device idiom. On iPad, you must present the view controller in a popover. On other devices, you must present it modally.

       --你要负责在不同设备上使用设备相应的方法来呈现和解散该VC。在iPad上,你必须在弹窗中呈现视图控制器。在其他设备上,必须以模态方式呈现。

See Also

Initializing the Activity View Controller

class UIActivityItemsConfiguration

A configuration that allows a responder to export data through a variety of interactions.

protocol UIActivityItemsConfigurationReading

 

 

 

 

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值