iOS如何实现官方共享功能

时间:2014-02-17 08:48:08

标签: ios facebook twitter share uiactivityviewcontroller

包括facebook,twitter,消息,电子邮件等,如下所示:

iOS share function

1 个答案:

答案 0 :(得分:2)

在ViewController.m中:

NSString *message = @"The Flyer http://flyerdream.tumblr.com";
UIImage *image = [UIImage imageNamed:@"flyer"];
NSArray *arrayOfActivityItems = [NSArray arrayWithObjects:message, image, nil];
UIActivityViewController *activityVC = [[UIActivityViewController alloc]
                                         initWithActivityItems:arrayOfActivityItems applicationActivities:nil];

[self.navigationController presentViewController:activityVC animated:YES completion:nil];