调用系统分享

NSData * data = [NSData dataWithContentsOfURL:[NSURL URLWithString:@"http://mmbiz.qpic.cn/mmbiz_jpg/nPQsuRTBhXNzc4m40MG7mV4CvTkKy7uD9Zs0jqOfFAqJrnbictUP8ibdp6cTTZVRr2hyQwb891NPziazuHsBzJRjA/640?wx_fmt=jpeg&tp=webp&wxfrom=5&wx_lazy=1"]];

UIImage *imagerang = [UIImage imageWithData:data];
NSURL * url = [NSURL URLWithString:@"http://mp.weixin.qq.com/s?__biz=MjYyNjk3NzY4MA==&mid=2653141577&idx=1&sn=6a17450a60f4187d60f65519c4212357&chksm=af7c92b6980b1ba023079540640fb60a50c19f49486859485de6469b4ebf8f77228fdbc9ebdd&mpshare=1&scene=1&srcid=1016sryHRjNCiyhPJuiOnHrC#rd"];

SharedItem *item = [[SharedItem alloc] initWithData:imagerang andFile:url];
    
//    UIActivity *act = [[UIActivity alloc] init];
//    act.activityType
UIActivityViewController *activityViewController =[[UIActivityViewController alloc] initWithActivityItems:@[url]
applicationActivities:nil];

//不显示其他分享的选项内容 
activityViewController.excludedActivityTypes = @[ UIActivityTypePostToFacebook,UIActivityTypePostToTwitter, UIActivityTypePostToWeibo, UIActivityTypeMessage,UIActivityTypeMail,UIActivityTypePrint,UIActivityTypeCopyToPasteboard,UIActivityTypeAssignToContact,UIActivityTypeSaveToCameraRoll,UIActivityTypeAddToReadingList,UIActivityTypePostToFlickr,UIActivityTypePostToVimeo,UIActivityTypePostToTencentWeibo,UIActivityTypeAirDrop,UIActivityTypeOpenInIBooks];
    
if (activityViewController) {
        [self presentViewController:activityViewController animated:TRUE completion:nil];
 }
调用系统分享_第1张图片
调用系统分享_第2张图片
调用系统分享_第3张图片

你可能感兴趣的:(调用系统分享)