zoukankan      html  css  js  c++  java
  • 图片压缩ShareSDK的简化压缩和使用例子

    文章结束给大家来个程序员笑话:[M]

        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

        

        

    文章结束给大家分享下程序员的一些笑话语录: Bphone之你们聊,我先走了!移动说:我在phone前加o,我叫o缝;苹果说:我在phone前i,我是i缝;微软说:我在phone前加w,我叫w缝;三星说:你们聊,我先走了!
    将来王建宙写回忆录的时候,一定要有一句“常小兵为中国移动的发展做出了不可磨灭的贡献”。

  • 相关阅读:
    又一种Mysql报错注入
    PHP wget 增强脱裤脚本(PDO MYSQL)
    一种少见的跨目录写webshell方法
    过狗一句话
    在myql sqlserver里边怎么快速找到带有关键字的表
    php读取3389脚本
    学习OpenCV,看这些!
    Git 学习看这篇就够了!
    开发工具使用技巧和插件大总结
    (资源整理)带你入门Spark
  • 原文地址:https://www.cnblogs.com/xinyuyuanm/p/3091386.html
Copyright © 2011-2022 走看看