Configure iOS 6 ActivityViewController for weibo etc.

I want to implement the new ActivityViewController iOS6, but I want to get rid of unused actions, such as message, copying, sharing on weibo, etc.

Can I customize or subclass it to remove these icons?

Thank you for your help!

+4
source share
1 answer

Ok, I found a solution to configure the UIActivityViewController myself:

if you want to get rid of sharing options like weibo, facebook, etc ... it's absolutely simple, just set the ExcludedActivityTypes property:

UIActivityViewController *actionCtrl = [[UIActivityViewController alloc]initWithActivityItems:act applicationActivities:nil]; [actionCtrl setExcludedActivityTypes:@[UIActivityTypeAssignToContact, UIActivityTypeCopyToPasteboard, UIActivityTypeMail, UIActivityTypePostToWeibo]]; [self presentViewController:actionCtrl animated:YES completion:nil]; 

If you want to add another action (button or image, etc.), you need to subclass UIActivity and overwrite some methods such as activityType and activityImage.

i.e.

 - (UIImage *)activityImage { return [UIImage imageNamed:@"icon"]; } 

You too will help you guys!

+10
source

Source: https://habr.com/ru/post/1441240/


All Articles