Protocol: UIActivityItemSource

Overview

The UIActivityItemSource protocol defines the methods used by a UIActivityViewController object to retrieve the data items to act on. You can use this protocol in situations where you want to provide the data from one of your app’s existing objects instead of creating a separate UIActivityItemProvider object. When implementing this protocol, your object becomes the data provider, providing the view controller with access to the items. Returns the data object to be acted upon. (required)Returns the placeholder object for the data. (required)

Instance Method Summary (collapse)

Instance Method Details

- (Object) activityViewController(activityViewController, itemForActivityType:activityType)

Returns the data object to be acted upon. (required) This method returns the actual data object to be acted on by an activity object. Your implementation of this method should create or generate the data object and return it as quickly as possible.

Parameters:

  • activityViewController (UIActivityViewController)

    The activity view controller object requesting the data item.

  • activityType (String)

    The type of activity to be performed with the data object. You can use this string to decide how best to prepare the data object.

Returns:

  • (Object)

    The final data object to be acted on.

- (Object) activityViewControllerPlaceholderItem(activityViewController)

Returns the placeholder object for the data. (required) This method returns an object that can be used as a placeholder for the real data. Placeholder objects do not have to contain any real data but should be configured as closely as possible to the actual data object you intend to provide.

Parameters:

  • activityViewController (UIActivityViewController)

    The activity view controller object requesting the placeholder item.

Returns:

  • (Object)

    An object to use as a placeholder for the actual data. The class of this object must match the class of the object you return from the activityViewController:itemForActivityType: method.