Pregunta

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!

¿Fue útil?

Solución

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!

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top