Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS 6 ActivityViewController customization of weibo, etc

i want to implement the new ActivityViewController of iOS6, but i want to get rid of the unused activities like message, copy, sharing on weibo, etc..

Is it possible to customize or subclass it to remove those icons?

Thanks for your help!

like image 448
Fry Avatar asked Dec 27 '22 15:12

Fry


1 Answers

Ok, i found a solution by myself to customize the UIActivityViewController:

if you want to get rid of sharing options like weibo, facebook, etc... its totally 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 Activity (button or image, etc.) you need so subclass the UIActivity and overwrite some methods like activityType and activityImage.

i.e.

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

You this helps you guys too!

like image 138
Fry Avatar answered Jan 12 '23 08:01

Fry