1创建UIActivityViewController 有连个数组类型的参数一个填写分享内容的详细信息,另一个现在不需要关注。
UIActivityViewController *activityView = [[UIActivityViewController alloc] initWithActivityItems:@[@"这里是标题", [UIImage imageNamed:@"Oauth"], [NSURL URLWithString:@"http://www.google.com"]] applicationActivities:activity];
2,添加不需要展示的ActivityTypes
activityView.excludedActivityTypes = @[UIActivityTypeAssignToContact, UIActivityTypeCopyToPasteboard, UIActivityTypePrint];
3,展示
[self presentViewController:activityView animated:YES completion:nil];
二
//分享的标题
NSString *textToShare = @"带你看世界。";
//分享的图片
UIImage *imageToShare = [UIImage imageNamed:@"图片名称"];
//分享的url
NSURL *urlToShare = [NSURL URLWithString:@"www.baidu.com"];
//在这里呢 如果想分享图片 就把图片添加进去 文字什么的通上
NSArray *activityItems = @[textToShare,imageToShare, urlToShare];
UIActivityViewController *activityView = [[UIActivityViewController alloc] initWithActivityItems:activityItems applicationActivities:nil];
// activityView.excludedActivityTypes = @[UIActivityTypeAirDrop];
[self presentViewController:activityView animated:YES completion:nil];
如果没有微信 在设置里边添加微信 即可。
网友评论