UIActivityItemSource Protocol Reference

Conforms to
Framework
/System/Library/Frameworks/UIKit.framework
Availability
Available in iOS 6.0 and later.
Declared in
UIActivityItemProvider.h

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.

Both methods of this protocol are required. Because the methods of this protocol are executed on your app’s main thread, you should avoid using this protocol in cases where the data objects might take a significant amount of time to create. When creating large data objects, consider using a UIActivityItemProvider object instead.

Tasks

Getting the Data Items

Instance Methods

activityViewController:itemForActivityType:

Returns the data object to be acted upon. (required)

- (id)activityViewController:(UIActivityViewController *)activityViewController itemForActivityType:(NSString *)activityType
Parameters
activityViewController

The activity view controller object requesting the data item.

activityType

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.

Return Value

The final data object to be acted on.

Discussion

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.

Availability
  • Available in iOS 6.0 and later.
Declared In
UIActivityItemProvider.h

activityViewControllerPlaceholderItem:

Returns the placeholder object for the data. (required)

- (id)activityViewControllerPlaceholderItem:(UIActivityViewController *)activityViewController
Parameters
activityViewController

The activity view controller object requesting the placeholder item.

Return Value

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.

Discussion

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.

Availability
  • Available in iOS 6.0 and later.
Declared In
UIActivityItemProvider.h

Did this document help you? Yes It's good, but... Not helpful...