天天看點

圖檔壓縮ShareSDK的簡化壓縮和使用例子

文章結束給大家來個程式員笑話:[M]

    share sdk 太大了  于是自己 開始簡化,  删除了 ipad 的圖檔和 framework ,  壓縮了 sharesdk 中的 圖檔,用幾k的圖檔 替換了幾個 200多k 的圖檔 

    隻保留了  QQ 微網誌 、 sina 微網誌 、 微信 朋友圈、微信好友分享、QQ空間   這5個 重要的分享平台

    修改壓縮後的 巨細。  所有圖檔都壓縮過了

圖檔壓縮ShareSDK的簡化壓縮和使用例子

    原始 巨細。

圖檔壓縮ShareSDK的簡化壓縮和使用例子

    應用 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縫;三星說:你們聊,我先走了!

将來王建宙寫回憶錄的時候,一定要有一句“常小兵為中國移動的發展做出了不可磨滅的貢獻”。