ShareSDK的简化压缩和使用例子

share sdk 太大了  于是自己 开始简化,  删除了 ipad 的图片和 framework ,  压缩了 sharesdk 中的 图片,用几k的图片 替换了几个 200多k 的图片 

只保留了  QQ 微博 、 sina 微博 、 微信 朋友圈、微信好友分享、QQ空间   这5个 主要的分享平台

修改压缩后的 大小。  所有图片都压缩过了

  

原始 大小。


使用 sharesdk 的分享流程 

+(void)shareTitle:(NSString *)title content:(NSString *)content image:(UIImage *)img
{
    //分享的 底ViewControoler
    id<ISSContainer> container = [ShareSDK container];
    
    //可以 设置 sharesdk 弹出的底ViewController
    //[container setIPhoneContainerWithViewController:nil];
    
    
    //自动授权
    id<ISSAuthOptions> authOptions = [ShareSDK authOptionsWithAutoAuth:YES
                                                         allowCallback:NO
                                                         authViewStyle:SSAuthViewStyleModal
                                                          viewDelegate:nil
                                               authManagerViewDelegate:nil];
    
    //在授权页面中添加关注官方微博
    [authOptions setFollowAccounts:@{SHARE_TYPE_NUMBER(ShareTypeSinaWeibo):[ShareSDK userFieldWithType:SSUserFieldTypeName valeu:@"哈哈哈啊哈啊哈哈_呃"]}];
    
    //要分享的列表
    NSArray *shareList = [ShareSDK getShareListWithType:ShareTypeSinaWeibo, ShareTypeTencentWeibo, ShareTypeQQSpace,ShareTypeWeixiSession,ShareTypeWeixiTimeline,nil];
    
    //分享界面 选项
    id<ISSShareOptions> shareOptions = [ShareSDK defaultShareOptionsWithTitle:title
                                                              oneKeyShareList:shareList
                                                               qqButtonHidden:YES
                                                        wxSessionButtonHidden:NO
                                                       wxTimelineButtonHidden:NO
                                                         showKeyboardOnAppear:YES
                                                            shareViewDelegate:nil
                                                          friendsViewDelegate:nil
                                                        picViewerViewDelegate:nil];
    
    //加入分享的图片
    id<ISSCAttachment> shareImage = nil;
    SSPublishContentMediaType shareType = SSPublishContentMediaTypeText;
    if(img)
    {
        shareImage = [ShareSDK pngImageWithImage:img];
        shareType = SSPublishContentMediaTypeNews;
    }

    //分享的内容
    id<ISSContent>publishContent=[ShareSDK content:content defaultContent:@"" image:shareImage title:title url:@"http://www.sharesdk.cn/" description:@"" mediaType:shareType];
    
    //弹出分享菜单
    [ShareSDK showShareActionSheet:container
                         shareList:shareList
                           content:publishContent
                     statusBarTips:YES
                       authOptions:authOptions
                      shareOptions:shareOptions
                            result:^(ShareType type, SSPublishContentState state, id<ISSStatusInfo> statusInfo, id<ICMErrorInfo> error, BOOL end) {
                                if (state == SSPublishContentStateSuccess)
                                {
                                    NSLog(@"分享成功");
                                }
                                else if (state == SSPublishContentStateFail)
                                {
                                    NSLog(@"分享失败,错误码:%d,错误描述:%@", [error errorCode], [error errorDescription]);
                                }
                            }];
    
}

上传资源慢了点

http://download.csdn.net/detail/li6185377/5422381



  • 1
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 5
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值