首先导入系统类库
social.framework
导入头文件:
#import <Social/social.h>
之后使用UIActivityViewController显示分享选项,代码如下: (增加微信分享)
NSArray*activity = @[[[WeixinSessionActivityalloc]init], [[WeixinTimelineActivityalloc]init]];
UIActivityViewController*activityView = [[UIActivityViewControlleralloc]initWithActivityItems:@[@"这里是标题", [NSURLURLWithString:@"http://www.google.com"]]applicationActivities:activity];
activityView.excludedActivityTypes= @[UIActivityTypeAssignToContact, UIActivityTypeCopyToPasteboard, UIActivityTypePrint,UIActivityTypePostToWeibo];
[selfpresentViewController:activityViewanimated:YEScompletion:nil];
网友评论