如何在UIactivityviewcontroller中添加Facebook,Twitter,邮件,消息图标

时间:2012-09-26 16:37:52

标签: iphone ios6

已将activityviewcontroller添加到主控制器

-(void)ActionSheet2:(id)sender
{
UIActivityViewController *activityViewController = [[UIActivityViewController alloc] init];

activityViewController.excludedActivityTypes = @[UIActivityTypePostToWeibo, UIActivityTypeAssignToContact ];

[self presentViewController:activityViewController animated:YES completion:NULL];

[activityViewController release];
}

当我点击actionsheet按钮时,它显示空白的activityviewcontroller,只有取消按钮。我现在如何在activityviewcontroller中添加Facebook,Twitter,电子邮件和iMessage作为共享服务。

感谢您的帮助。

1 个答案:

答案 0 :(得分:8)

     //Include an array of things being attached to the ActivityViewController
     //The Array cannot be nil, you must provide something. Either an image or text or both
      NSArray *activityItems = @[@"Hello",[UIImage imageNamed:@"someImage"]];
      UIActivityViewController *activityViewController = [[UIActivityViewController alloc] initWithActivityItems:activityItems applicationActivities:nil];
      activityViewController.excludedActivityTypes = @[UIActivityTypePostToWeibo, UIActivityTypeAssignToContact ];    
       [self presentViewController:activityViewController animated:YES completion:NULL];      
       [activityViewController release];