模仿快捷分享、从下往上弹出窗口,自定义分享菜单
来源:互联网 发布:手机淘宝老版本官方 编辑:程序博客网 时间:2024/05/16 19:53
shareSDK快捷分享,有集成好的分享菜单栏,很方便好用但是只能是一种样式,总感觉很枯燥无味!我在集成的过程中还发现,快捷分享的成功失败很难拿到回调。所以下面介绍一种自定义的分享菜单以及对平台的定向分享,话不多说上代码,相信很容易看懂!
-(void)shareClick{
//**** 从下往上弹出窗口 ******//
shareview =[MyCtrolcreateViewWithFrame:CGRectMake(10,0, Width-20,150)];
shareview.layer.cornerRadius=8;
shareview.frame =CGRectMake(0,Height, Width,Height/2);
[UIViewanimateWithDuration:.5animations:^{
shareview.frame =CGRectMake(10,Height-250,Width-20,250);
}];
shareview.backgroundColor=[UIColorclearColor];
//**** 从下往上弹出窗口 ******//
//**** 各平台的分享菜单栏 ******//
UIView * topView =[MyCtrolcreateViewWithFrame:CGRectMake(0,0, Width-20,100)];
topView.backgroundColor=[UIColorwhiteColor];
topView.layer.cornerRadius=8;
//**** 各平台的分享菜单栏 ******//
//**** 取消弹出的分享菜单栏 ******//
UIButton *btn =[MyCtrolcreateBuuttonWithFrame:CGRectMake(0,120, Width-20,35) ImageName:nilTarget:selfAction:@selector(cancebtnlClick)Title:@"取消"];
btn.layer.cornerRadius=8;
btn.backgroundColor=[UIColorwhiteColor];
//**** 取消弹出的分享菜单栏 ******//
[shareviewaddSubview:btn];
[shareviewaddSubview:topView];
[BGviewaddSubview:shareview];
//**** 编辑菜单栏对应平台logo以及点击事件触发的定向分享 ******//
NSArray *array =@[@"wechat@2x",@"pengyouquan@2x"];
NSArray *array1 =@[@"微信",@"朋友圈"];
for(int i =0 ;i<2 ;i++){
UIButton *shareBtn = [MyCtrolcreateBuuttonWithFrame:CGRectMake(Width/7+Width/2.08*i,10, Width/5.35,Width/5.35)ImageName:array[i] Target:selfAction:@selector(sharebtnClick:)Title:nil];
shareBtn.tag=100+i;
UILabel *labtext =[MyCtrolcreateLabelWithFrame:CGRectMake(Width/7+Width/2.08*i,80, Width/5.35,20) Font:12Text:array1[i]];
labtext.textAlignment=1;
[shareviewaddSubview:labtext];
[shareviewaddSubview:shareBtn];
}
//**** 取消弹出的分享菜单栏 ******//
}
-(void)cancebtnlClick{
[shareviewremoveFromSuperview];
}
//********设置分享参数************
-(void)sharebtnClick:(UIButton *)btn{
NSURL *url =[NSURLURLWithString:shareurl];
NSMutableDictionary *shareParams = [NSMutableDictionarydictionary];
[shareParams SSDKSetupShareParamsByText:@"凌猫停车扫码领券,分享有礼!"
images:imgurl
url:url
title:@"凌猫扫码领券"
type:SSDKContentTypeAuto];
if(btn.tag==100){
[selfstartSharePlatform:SSDKPlatformSubTypeWechatSessionparameters:shareParams];
}elseif(btn.tag==101){
[selfstartSharePlatform:SSDKPlatformSubTypeWechatTimelineparameters:shareParams];
}
}
-(void)startSharePlatform:(SSDKPlatformType)platform parameters:(NSMutableDictionary *)parameters{
[ShareSDKshare:platform parameters:parametersonStateChanged:^(SSDKResponseState state,NSDictionary *userData, SSDKContentEntity *contentEntity,NSError *error) {
switch (state) {
caseSSDKResponseStateSuccess:
{
[BGviewremoveFromSuperview];
break;
}
caseSSDKResponseStateCancel:
{
[BGviewremoveFromSuperview];
break;
}
default:
break;
}
}];
}
- 模仿快捷分享、从下往上弹出窗口,自定义分享菜单
- 对话框从下往上弹出---模仿微信退出
- 动画之从上到下,从下往上弹出
- 分享从下向上弹出的popwindow
- 手把手教会popupWindow从下往上弹出效果的实现
- 手把手教会popupWindow从下往上弹出效果的实现
- popupWindow从下往上弹出效果的实现
- popupWindow从下往上弹出效果的实现
- 手把手教会popupWindow从下往上弹出效果的实现
- 手把手教会popupWindow从下往上弹出效果的实现
- 手把手教会popupWindow从下往上弹出效果的实现
- popupWindow从下往上弹出效果的实现
- 手把手教会popupWindow从下往上弹出效果的实现
- Android 动画之从上到下,从下往上弹出
- 实现类似分享 和支付窗口 从界面下面弹出Style
- 右键弹出快捷菜单
- iOS 微信分享整理 - 自定义分享菜单
- BottomDialog 一个自定义的从底部弹出的 dialog,仿照微博的分享弹框
- table标签表格宽高失效以及前端知识回顾
- Android系统广播大全及开机自启的service
- 安装配置Android开发环境SDK
- Android异步处理技术
- ?371. Sum of Two Integers(C++)
- 模仿快捷分享、从下往上弹出窗口,自定义分享菜单
- android中ActionBar
- RCNN学习笔记(1):Rich feature hierarchies for accurate object detection and semantic segmentation
- TI-CC2640R2-Sensor Controller 开发应用
- Linux for Ubuntu 解决WPS安装缺少libpng12-0的问题
- 搭建FTP服务 搭建Http静态服务器环境
- mysql5.7 启用gtid,导致无法创建和删除表
- HashMap
- CentOS服务器下安装配置SSL