ios - Share data with different types in UIActivityViewController -
ios - Share data with different types in UIActivityViewController -
there extremely similar question asked next post: different info sharing providers in uiactivityviewcontroller. question different.
i know how share different different info of same type different activities using itemforactivitytype
. example:
- (id) activityviewcontroller:(uiactivityviewcontroller *)activityviewcontroller itemforactivitytype:(nsstring *)activitytype { if ( [activitytype isequaltostring:uiactivitytypeposttotwitter] ) homecoming @"this #twitter post!"; if ( [activitytype isequaltostring:uiactivitytypeposttofacebook] ) homecoming @"this facebook post!"; if ( [activitytype isequaltostring:uiactivitytypeairdrop] ) homecoming @"airdrop message text"; else homecoming nil; }
however, question is: what if have different kind of info share different activities, should do?. example, if share:
a string on twitter; a array of string , and image on facebook; the actual info of image (e.g. nsdata) airdrop.p.s.:
i looked @ next protocol function:
- (id)activityviewcontrollerplaceholderitem:;
however, cannot utilize because don't know value of activitytype
here.
you'd want create , share 2 or more objects conform uiactivityitemsource, 1 returns string, 1 image, etc. when delegate callback requesting item called check activity type selected (facebook, mail, airdrop, etc) , have 1 or multiple of itemsource's homecoming nil if item doesn't apply activity. create sure chosen activity @ to the lowest degree 1 of item's homecoming non-nil value.
you can take @ airdrop sample code examples of how implement uiactivityitemsource
ios objective-c ios7
Comments
Post a Comment