专栏名称: 3033
iOS开发
目录
相关文章推荐
游戏那点事Gamez  ·  炸裂,《鸣潮》今天又破纪录了:一举冲畅销Top2! ·  4 天前  
赛先生  ·  黑尔戈兰2025:物理与政治 | ... ·  3 天前  
科普中国  ·  这些事情,小时候真心相信过! ·  3 天前  
51好读  ›  专栏  ›  3033

2017友盟最新封装与CocoaPods升级

3033  · 掘金  ·  · 2017-12-14 00:35

正文

请到「今天看啥」查看全文


typedef NS_ENUM(NSUInteger,umSocialShareType) {
    
    UMS_SHARE_TYPE_IMAGE = 0,//只分享图片
    UMS_SHARE_TYPE_ALL = 1,//图片文字链接
};

方法1.点击需要分享的地方弹出多个分享平台,然后选择具体的平台进行分享。

根据不同的枚举值确定点击的某个平台的分享类型,然后传入不同的数据参数。

/**
 *  弹出多个平台 选择分享至某一个
 *  sharePlatType 分享的类型 图片模式 还是图文链接模式
 *  shareTitle   分享的标题  图片模式时可传nil
 *  shareCotent  分享的内容  图片模式时可传nil
 *  shareImage   分享的图片 UIImage类对象,也可以是NSdata类对象,也可以是图片链接imageUrl NSString类对象
 *  shareWebUrl  分享点击对应的web页的URL  图片模式时可传nil
 *  @param block 回调block
 */
- (void)umSocial_ShareWithControll:(UIViewController *)PrsentControll withPlatShareType:(umSocialShareType)shareType withTitle:(NSString*)shareTitle withCotent:(NSString*)shareCotent withImage:(id)shareImage withWebUrl:(NSString*)shareWebUrl withCompletionHandler:(UMSocialRequestCompletionHandler)completionHandler;

方法的实现如下:

/**
 *  弹出多个平台 选择分享至某一个
 *  sharePlatType 分享的类型 图片模式 还是图文链接模式
 *  @param block 回调block
 */
- (void)umSocial_ShareWithControll:(UIViewController *)PrsentControll withPlatShareType:(umSocialShareType)shareType withTitle:(NSString*)shareTitle withCotent:(NSString*)shareCotent withImage:(id)shareImage withWebUrl:(NSString*)shareWebUrl withCompletionHandler:(UMSocialRequestCompletionHandler)completionHandler{
    
    switch (shareType) {
        case UMS_SHARE_TYPE_IMAGE://只分享图片
        {
            [UMSocialUIManager setPreDefinePlatforms:platFormArray];
            [UMSocialUIManager showShareMenuViewInWindowWithPlatformSelectionBlock:^(UMSocialPlatformType platformType, NSDictionary *userInfo) {
                
                [self runShareImageWithType:platformType WithControll:PrsentControll withImage:shareImage withCompletionHandler:(UMSocialRequestCompletionHandler)completionHandler ];
            }];
        }
            break;
        case UMS_SHARE_TYPE_ALL://图片文字链接
        {
            
            [UMSocialUIManager setPreDefinePlatforms:platFormArray];
            [UMSocialUIManager showShareMenuViewInWindowWithPlatformSelectionBlock:^(UMSocialPlatformType platformType, NSDictionary *userInfo) {
                
                [self runShareAllWithType:platformType WithControll:PrsentControll withTitle:shareTitle withCotent:shareCotent withImage:shareImage withWebUrl:shareWebUrl withCompletionHandler:(UMSocialRequestCompletionHandler)completionHandler ];
            }];
        }
            break






请到「今天看啥」查看全文