Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add different text to UIActivityViewController objects

I have implemented a UIActivityViewController, for sharing some information. In this case I have a question: Is it possible to make a different text between the facebook sharing/twitter sharing/ or mail sharing? That the text which is set is different from the others...

A good UIActivityViewController tutorial would be very useful.

My code at the time is, for displaying text and image:

NSString *text = @"Lime Cat";
        UIImage *image = [UIImage imageNamed:@"MyApp Icon 512x512.png"];
        NSArray *items = [NSArray arrayWithObjects:text,image , nil];

But how can I manage it that the NSString is just for the mail, and make a seperate NSString for the facebook share option?

Any suggestions?

Thanks.

like image 677
MasterRazer Avatar asked Nov 02 '12 22:11

MasterRazer


2 Answers

you can go to the link bellow, there is a tutorial that can help you :

https://www.albertopasca.it/whiletrue/objective-c-custom-uiactivityviewcontroller-icons-and-text/

like image 106
amau96 Avatar answered Nov 13 '22 07:11

amau96


You can have your class conform to the UIActivityItemSource protocol and implement activityViewController:itemForActivityType:. The activityType will be FB, Twitter, Messages app, etc, so you can do a switch on it and return a different object based on the activity.

like image 21
James Kuang Avatar answered Nov 13 '22 05:11

James Kuang