Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UIActivityViewController use items in specific actions

I have a UIActivityViewController and i want to make it have all the actions safari does and more. Currently i can only get mail, messages, twitter, facebook and a semi-working copy. I set the activity items array with a url. I then added a nsstring of that url and added that with the url, and everything worked good like copying worked better by copying the string and i paste it in more areas. But when having the string also, twitter and facebook added the urls into their text and include the link. How can i make it so they dont have the text, just the link? Another issue is how can i show the web view preview in the link on the twitter and facebook activities? it just shows a safari icon. And third question is how can i print the contents of the web page?

like image 586
Maximilian Litteral Avatar asked Dec 27 '22 09:12

Maximilian Litteral


1 Answers

To provide different items for different services, you subclass UIActivityItemProvider. It conforms to UIActivityItemSource protocol, so you implement method:

- (id)activityViewController:(UIActivityViewController *)activityViewController
         itemForActivityType:(NSString *)activityType {
    // compare `activityType` and return what you want
}
like image 182
Tricertops Avatar answered May 25 '23 04:05

Tricertops