模态视图1-底部弹出分享按钮
2016-11-22 11:17
253 查看
项目中加了功能,分享进微信微博什么的,就写了分享界面
!!里面布局用的第三方SDAutoLayout,网上一搜就能找到
!!里面布局用的第三方SDAutoLayout,网上一搜就能找到
//#################################################################################################### //###### 分割线.h文件 ############ //#################################################################################################### #import @protocol ShareModalViewButtonDelegate -(void)clickShareButtonWithTag:(NSInteger)tag; //在实现代理的地方,按照tag对应操作,比如0对应微信,1对应朋友圈这样的 @end @interface ShareModalViewController : UIViewController @property(nonatomic,weak)iddelegate; @property(nonatomic,strong) NSArray *buttonImages; //图片名称数组,对应着顺序生成按钮 //每四个一行,如果有五个按钮,会自动适应尺寸,变为两行显示 @property(nonatomic,strong) NSArray *buttonTitles; //按钮titles,按图片对应顺序 @end //#################################################################################################### //###### 分割线.m文件 ############ //#################################################################################################### #import "ShareModalViewController.h" //设定按钮标记基数 #define ShareButtonTagBase 161118 @interface ShareModalViewController (){ } @property(nonatomic,strong) UIView *buttonsView; //按钮部分视图 @property(nonatomic,strong) UIView *backView; //黑色透明蒙板视图 @property(nonatomic,assign) NSInteger buttonsViewEdge; //UI尺寸,根据设备设定: @property(nonatomic,assign) NSInteger buttonW; @property(nonatomic,assign) NSInteger buttonH; @property(nonatomic,assign) NSInteger gapX; @property(nonatomic,assign) NSInteger gapY; @property(nonatomic,assign) NSInteger buttonsViewHeight; @property(nonatomic,assign) NSInteger backButtonHeight; @property(nonatomic,assign) NSInteger buttonTitleFontSize; @end @implementation ShareModalViewController - (void)viewDidLoad { [super viewDidLoad]; if(MainScreenWidth>370){ //根据屏幕尺寸设置尺寸参数,这算是一种比较二的做法。。 _buttonsViewEdge=20; _buttonW=70; _buttonH=90; _gapX=(MainScreenWidth-_buttonsViewEdge*2-_buttonW*4)/3; _gapY=10; _backButtonHeight=45; _buttonTitleFontSize=15; _buttonsViewHeight=_buttonsViewEdge*2+_gapY+_buttonH*2+_backButtonHeight; }else if(MainScreenWidth>300){ _buttonsViewEdge=15; _buttonW=60; _buttonH=75; _gapX=(MainScreenWidth-_buttonsViewEdge*2-_buttonW*4)/3; _gapY=10; _backButtonHeight=38; _buttonTitleFontSize=12; _buttonsViewHeight=_buttonsViewEdge*2+_gapY+_buttonH*2+_backButtonHeight; } [self createUI]; //创建界面 } //创建UI -(void)createUI{ //背景蒙黑视图 _backView=[[UIView alloc]initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height)]; _backView.backgroundColor=[UIColor blackColor]; _backView.alpha=0; [self.view addSubview:_backView]; UITapGestureRecognizer *tapGesture=[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(back)]; [_backView addGestureRecognizer:tapGesture]; //按钮集合View-用来添加所有按钮 _buttonsView=[[UIView alloc]initWithFrame:CGRectMake(0, MainScreenHeight, MainScreenWidth,_buttonsViewHeight )]; _buttonsView.backgroundColor=UIColorFromRGB(0xF2F2F2, 1.0); [self.view addSubview:_buttonsView]; /********批量生成按钮********* * */ NSInteger buttonNUM=[self.buttonImages count]; //按钮的总数量 for(NSInteger num=0;num
相关文章推荐
- Cocos2dx中在场景中弹出模态层时按钮的处理方法
- android 弹出软键盘将底部视图顶起问题
- iOS 自定义微信分享底部弹出选择界面
- Android 带动画的底部弹出视图
- Android实现背景透明度渐变的效果,类似于分享底部的弹出框
- IOS中如何在弹出的视图控制器中不显示底部选项卡
- ios开发学习-弹出视图(Popup View) 效果源码分享--系列教程1
- 模态视图那些事(二)之 弹出视图样式
- 自定义Dialog用于电话咨询,具有从底部弹出效果,点击按钮改变颜色
- ios开发学习-弹出视图(Popup View) 效果源码分享--系列教程2
- OpenERP-隐藏多对多域弹出列表视图的"新建"按钮(Hide the "Create" button from the popup list view of a many2many field)
- 【AmazeUI】底部导航栏与分享按钮
- IOS UI:弹出视图/弹出模态 presentViewController与presentModalViewController(增加IOS 6.0说明)
- listview滑动到底部弹出按钮-button占用了listview的显示位置(尽力理解尽力解决)
- ios开发学习-弹出视图(Popup View) 效果源码分享--系列教程3
- PopupWindow 实现仿微信底部弹出的分享菜单
- Android实现底部弹出按钮菜单升级版
- android 弹出软键盘将底部视图顶起问题
- Android 带动画的底部弹出视图
- jQuery点击弹出层弹出模态框点击模态框消失代码分享