4

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!

Fry
  • 922
  • 2
  • 10
  • 24
  • Why not just keep them there, the user might want to use them. – rckoenes Oct 22 '12 at 09:24
  • But thats app specific, if you not support sharing on it or your customer doesnt want to share on that platform, why should i leave them in there? i just want to get rid of weibo actually! – Fry Oct 22 '12 at 09:27

1 Answers1

10

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!

Fry
  • 922
  • 2
  • 10
  • 24