ShareSDK自帶視圖彈出框感覺沒有那么美觀,但是ShareSDK也預留了自定義視圖調(diào)用分享的方法,可以根據(jù)自己的需求定義比較美觀的視圖,然后調(diào)用相對應的方法就可以了,一起來看看廓啊,挺簡單的。
主要代碼:
-(void)clickedSharedItem:(UIButton*)button {
intshareType =0;
switch(button.tag) {
case10: {
shareType =SSDKPlatformSubTypeWechatSession;
}
break;
case11: {
shareType =SSDKPlatformSubTypeWechatTimeline;
}
break;
case12: {
shareType =SSDKPlatformSubTypeQQFriend;
}
break;
default:
break;
}
NSMutableDictionary*shareParams = [NSMutableDictionarydictionary];
[shareParamsSSDKSetupShareParamsByText:@"注冊就送"
images:self.single.headerimg
url:[NSURLURLWithString:shareUrl]
title:@"你敢來,我就敢送!"
type:SSDKContentTypeAuto];
[ShareSDK share:shareTypeparameters:shareParams onStateChanged:^(SSDKResponseStatestate,NSDictionary*userData,SSDKContentEntity*contentEntity,NSError*error) {
switch(state) {
caseSSDKResponseStateSuccess:{
if(self.block) {
self.block(state,@"succeed");
}
break;
}
caseSSDKResponseStateFail: {
if(self.block) {
NSString*resultString =@"分享失敗!";
if(shareType ==SSDKPlatformSubTypeQQFriend&& ![QQApiInterfaceisQQInstalled]) {
resultString =@"您的手機沒有安裝QQ!";
}elseif((shareType ==SSDKPlatformSubTypeWechatSession|| shareType ==SSDKPlatformSubTypeWechatTimeline) && ![WXApiisWXAppInstalled]) {
resultString =@"您的手機沒有安裝微信!";
}
self.block(state,resultString);
}
break;
}
default:
break;
}
}];
}