美文网首页
调用系统分享

调用系统分享

作者: Sunnyxi | 来源:发表于2016-10-17 19:05 被阅读47次
    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];
     }
    

    相关文章

      网友评论

          本文标题:调用系统分享

          本文链接:https://www.haomeiwen.com/subject/jjlzyttx.html