问题
So for example, if the user wants to share with twitter, the text would be different than if a user chooses to share with email.
How would I code that with initWithActivityItems?:
UIActivityViewController *activityVC = [[UIActivityViewController alloc] initWithActivityItems:objectsToShare applicationActivities:nil];
回答1:
Instead of objectsToShare, supply an object that adopts the UIActivityItemSource protocol. This protocol means your object will be called with activityViewController:itemForActivityType:. The second parameter that tells you the activity type. Thus you can return a different item, depending on the activity type.
来源:https://stackoverflow.com/questions/40296314/can-you-set-the-text-based-on-the-application-user-chooses-to-share-with-uiactiv