iOS 之UIAlertController的使用方法
来源:互联网 发布:命令者模式 java 编辑:程序博客网 时间:2024/06/07 05:16
UIAlertView在IOS 8以上版本已经过时了,官方推荐我们使用UIAlertController代替UIAlertView、UIActionSheet
1、UIAlertController显示普通的Alert
2、UIAlertController显示带文本输入的的Alert
3、UIAlertController显示ActionSheet
- (IBAction)showSheet:(UIButton *)sender { //显示弹出框列表选择 UIAlertController* alert = [UIAlertController alertControllerWithTitle:@"Title" message:@"This is an Sheet." preferredStyle:UIAlertControllerStyleActionSheet]; UIAlertAction* cancelAction = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * action) { //响应事件 NSLog(@"action = %@", action); }]; UIAlertAction* deleteAction = [UIAlertAction actionWithTitle:@"删除" style:UIAlertActionStyleDestructive handler:^(UIAlertAction * action) { //响应事件 NSLog(@"action = %@", action); }]; UIAlertAction* saveAction = [UIAlertAction actionWithTitle:@"保存" style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { //响应事件 NSLog(@"action = %@", action); }]; [alert addAction:saveAction]; [alert addAction:cancelAction]; [alert addAction:deleteAction]; [self presentViewController:alert animated:YES completion:nil]; }
原文章地址:IOS使用UIAlertController三种显示提示框代码
阅读全文
0 0
- iOS 之UIAlertController的使用方法
- iOS开发之UIAlertController新版的使用方法
- iOS UIAlertController UIAlertAction使用方法
- iOS UIAlertController使用方法如何使用
- iOS开发之UIAlertController的使用
- iOS 开发之UIAlertController
- IOS开发之UIAlertController
- IOS开发之UIAlertController
- iOS之UIAlertController
- iOS 9之UIAlertController、编码
- ios基本控件之UIAlertController
- iOS --- UI系列之UIAlertController
- iOS-UIAlertController的另类使用
- iOS UIAlertController 的常用方法
- uikit 中uialert 的使用方法UIAlertController
- UIAlertController之ActionSheet的使用
- IOS开发之IOS8.0最新UIAlertController
- iOS,UIAlertController
- pullTofresh+AsynTask
- spring线程池ThreadPoolExecutor配置并且得到任务执行的结果
- rpm包的安装,查询,卸载,升级,校验,数据库重建,验证数据包
- 一个从网络获取数据的封装类,以及接口回调
- springboot + thymeleaf + mybatis + ueditor
- iOS 之UIAlertController的使用方法
- RocketMQ 快速入门
- pycharm 使用心得(一)安装和首次使用
- 关于Java代码优化的一些总结
- 没有学位和工作经验要怎么找到UX设计的工作
- linux中platform总线解析(二)(platform设备的注册)
- Glide RecyclerView插件
- union和left join的应用区别
- Thinkphp5 使用odbc连接到sqlserver, thinkphp5 sqlserver where 报错的原因