Reputation: 24416
How would I provide a completely different set of data to each service in with a UIActivityViewController?
For instance:
Upvotes: 3
Views: 1520
Reputation: 2384
You can provide different data for different activities by creating a class that adopts UIActivityItemSource
protocol and implements the method:
-(id)activityViewController:itemForActivityType:
Then pass the object of your custom class to your UIActivityViewController
in activityItems array with a call -(id)initWithActivityItems:applicationActivities:
From documentation of this method:
... Instead of actual data objects, the objects in this array can be objects that adopt the UIActivityItemSource protocol, such as UIActivityItemProvider objects. ...
Here is a tutorial about how to do that: https://www.albertopasca.it/whiletrue/objective-c-custom-uiactivityviewcontroller-icons-and-text/
Upvotes: 4