更加方便的自定义弹框--随意修改样式,支持自己创建自定义的view添加覆盖
来源:互联网 发布:学校办公oa系统 源码 编辑:程序博客网 时间:2024/06/06 12:51
只用在自己工程需要弹出框的地方,如下调用即可
-(void)showAlertView:(NSInteger)row{ switch (row) { case 0: { [ECGCustomAlertView showTwoButtonsWithTitle:@"提示信息" Message:@"这里为提示的信息内容,里面会根据内容的高度进行计算,当大于弹出窗默认的高度时会自行适应高度(并自动转成UITextView来加载内容)" ButtonType:ECGAlertViewButtonTypeNone ButtonTitle:@"取消" Click:^{ NSLog(@"您点取消事件"); } ButtonType:ECGAlertViewButtonTypeNone ButtonTitle:@"确定" Click:^{ NSLog(@"你点确定事件"); }]; break; } case 1: { [ECGCustomAlertView showOneButtonWithTitle:@"信息提示" Message:@"你可以单独设置底部每个Button的样式,只要相应枚举进行调整,若不满足可以对针WJYAlertView源代码进行修改,增加相应的枚举类型及其代码" ButtonType:ECGAlertViewButtonTypeNone ButtonTitle:@"知道了" Click:^{ NSLog(@"响应事件"); }]; break; } case 2: { [ECGCustomAlertView showOneButtonWithTitle:nil Message:@"你可以把Title设置为nil" ButtonType:ECGAlertViewButtonTypeNone ButtonTitle:@"知道了" Click:^{ NSLog(@"响应事件"); }]; break; } case 3: { [ECGCustomAlertView showTwoButtonsWithTitle:@"提示信息" Message:@"你可以设置ButtonType的样式来调整效果,而且还可以分开设置,更加灵活,不效果项目要求可以修改源代码" ButtonType:ECGAlertViewButtonTypeCancel ButtonTitle:@"取消" Click:^{ NSLog(@"您点取消事件"); } ButtonType:ECGAlertViewButtonTypeDefault ButtonTitle:@"确定" Click:^{ NSLog(@"你点确定事件"); }]; break; } case 4: { [ECGCustomAlertView showMultipleButtonsWithTitle:@"信息内容" Message:@"可以设置多个的Button,同样也是可以有不同的样式效果" Click:^(NSInteger index) { NSLog(@"你点击第几个%zi", index); } Buttons:@{@(ECGAlertViewButtonTypeDefault):@"确定"},@{@(ECGAlertViewButtonTypeCancel):@"取消"},@{@(ECGAlertViewButtonTypeWarn):@"知道了"}, nil]; break; } case 5: { //自定义视图 UIView *customView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 240, 200)]; customView.backgroundColor = [UIColor blueColor]; UIButton *btn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 100, 40)]; [btn setTitle:@"点我关闭" forState:UIControlStateNormal]; btn.center = CGPointMake(120, 100); [customView addSubview:btn]; [btn addTarget:self action:@selector(closeBtnClick) forControlEvents:UIControlEventTouchUpInside]; // dismissWhenTouchedBackground:NO表示背景蒙层没有关闭弹出窗效果 _alertView = [[ECGCustomAlertView alloc] initWithCustomView:customView dismissWhenTouchedBackground:NO]; [_alertView show]; break; } case 6: { [ECGCustomAlertView showContainsTextViewWithTitle:@"消息内容" leftButtonTitle:@"取消" rightButtonTitle:@"确定" placeholderText:@"请输入正确的订单号" tipLabelTitle:150 click:^(int index, NSString *content) { NSLog(@"点击的是index为%d内容为%@",index,content); }]; break; } case 7: { [ECGCustomAlertView showContainsTextViewWithTitle:nil leftButtonTitle:@"取消" rightButtonTitle:@"确定" placeholderText:@"请输入正确的订单号" tipLabelTitle:200 click:^(int index, NSString *content) { NSLog(@"点击的是index为%d内容为%@",index,content); }]; break; } default: break; }}-(void)closeBtnClick{ // 如果没有其它事件要处理可以直接用下面这样关闭 // [_alert dismissWithCompletion:nil]; [_alertView dismissWithCompletion:^{ // 处理内容 NSLog(@"弹出窗被关闭了"); }];}
demo免费下载地址:
点击打开链接
1 0
- 更加方便的自定义弹框--随意修改样式,支持自己创建自定义的view添加覆盖
- Android高拓展性,更加方便的自定义Dialog.
- 自定义view学习-创建自己的九宫格解锁view
- android 自定义view的样式
- Android自定义View时添加自己的监听器
- Android自定义View时添加自己的监听器
- Android自定义View时添加自己的事件监听器
- 为自己的自定义View添加额外属性
- 添加自定义的 字体样式
- 自定义View实现Android圆形进度条,支持自定义显示的样式
- 如何自定义自己的VIEW
- 添加自定义View的Widget
- 自定义View(视图)的创建、添加、移除细节分析
- 创建自定义的View类
- 创建自定义的View类
- 通过 MarqueeFactory 来提供各种样式的跑马灯 View, 支持自定义跑马灯 ItemView
- 自定义View自己的简单理解
- 自己学习自定义view的一些总结
- WKWebView
- 从0开始学习 GitHub 系列之「04.向GitHub 提交代码」
- git tag — 标签相关操作
- GitHub使用
- 微信小程序功能介绍
- 更加方便的自定义弹框--随意修改样式,支持自己创建自定义的view添加覆盖
- 【计算机视觉】人脸识别--人脸识别技术综述
- SVM求解过程
- http中的expect
- Retrofit - java动态加载的思考以及过程中的anything else
- php5-7 各版本的特性
- Bitmap转成高斯模糊图片
- Linux中more和less命令用法
- EXTJS4 gridpanel中动态的显示/隐藏某个列