UIAlertController使用
// 将UIAlertController模态出来 相当于UIAlertView show 的方法// 初始化一个一个UIAlertController
// 参数preferredStyle:是IAlertController的样式
// UIAlertControllerStyleAlert 创建出来相当于UIAlertView
// UIAlertControllerStyleActionSheet 创建出来相当于 UIActionSheet
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"提示" message:@"调课通知将发给选定同学" preferredStyle:(UIAlertControllerStyleAlert)];
// 创建按钮
UIAlertAction *okAction = [UIAlertAction actionWithTitle:@"确定" style:(UIAlertActionStyleDefault) handler:^(UIAlertAction *action) {
[self.navigationController popViewControllerAnimated:YES];
}];
// 创建按钮
// 注意取消按钮只能添加一个
UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"取消" style:(UIAlertActionStyleCancel) handler:^(UIAlertAction *action) {
// 点击按钮后的方法直接在这里面写
NSLog(@"注意学习");
}];
// // 创建警告按钮
// UIAlertAction *structlAction = [UIAlertAction actionWithTitle:@"警告" style:(UIAlertActionStyleDestructive) handler:^(UIAlertAction *action) {
// NSLog(@"注意学习");
// }];
//
// 添加按钮 将按钮添加到UIAlertController对象上
[alertController addAction:okAction];
[alertController addAction:cancelAction];
//[alertController addAction:structlAction];
// 只有在alert情况下才可以添加文本框
// [alertController addTextFieldWithConfigurationHandler:^(UITextField *textField) {
// textField.placeholder = @"用户名";
// textField.secureTextEntry = YES;
// }];
// // 取出文本
// UITextField *text = alertController.textFields.firstObject;
// UIAlertAction *action = alertController.actions.firstObject;
[self presentViewController:alertController animated:YES completion:nil];
UIAlertController使用的更多相关文章
- UIAlertController
楼主在整理项目的警告,于是乎你懂的. 然后自己整理了一下以后方便自己忘了之后能及时找到它 关于UIAlertController .h文件的解析 /** 关于UIAlertController的解析 ...
- iOS UIAlertController跟AlertView用法一样 && otherButtonTitles:(nullable NSString *)otherButtonTitles, ... 写法
今天写弹出框UIAlertController,用alertView习惯了,所以封装了一下,跟alertView用法一样,不说了,直接上代码: 先来了解一下otherButtonTitles:(nul ...
- IOS UIAlertController 使用方法
在很多种语言中,alert都表示弹窗操作,弹窗功能非常有用,不仅可以用于正式的app功能中,也可以在调试中使用.在OC中,UIAlertController类用来控制弹窗操作.在IOS 8.0之前, ...
- UI控件(UIAlertController)
@implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; UIButton *_button = [UIBut ...
- UIAlertController 部分用法及属性
//创建UIAlertController:初始化UIAlertController 需要使用alertControllerWithTitle UIAlertController *alertCont ...
- iOS--UIAlertView与UIAlertController和UIAlertAction之间的事儿
iOS 8的新特性之一就是让接口更有适应性.更灵活,因此许多视图控制器的实现方式发生了巨大的变化.全新的UIPresentationController在实现视图控制器间的过渡动画效果和自适应设备 ...
- 开始使用 UIAlertController 吧
UIAlertView 与 UIActionSheet UIAlertView 样式 实现 - (void)showAlertView { self.alertView = [[UIAlertView ...
- UI第十四节——UIAlertController
- (void)viewDidLoad { [super viewDidLoad]; UIButton *alertBtn = [UIButton buttonWithType:U ...
- iOS 8.0后使用UIAlertController
iOS 8的新特性之一就是让接口更有适应性.更灵活,因此许多视图控制器的实现方式发生了巨大的变化.全新的UIPresentationController在实现视图控制器间的过渡动画效果和自适应设备尺寸 ...
随机推荐
- IIS请求筛选模块被配置为拒绝超过请求内容长度的请求
HTTP错误404.13 - Not Found 请求筛选模块被配置为拒绝超过请求内容长度的请求,原因是Web服务器上的请求筛选被配置为拒绝该请求,因为内容长度超过配置的值(IIS 7 默认文件上传大 ...
- margin()与offset()的区别
margin() 简写属性在一个声明中设置所有外边距属性. offset() 方法返回或设置匹配元素相对于文档的偏移(位置).
- 12月8日phpcms添加子栏目后的读取
一个栏目下面如果没有子栏目,那么它调用的模板就是列表页模板(及list_为前缀的模板):如果一个栏目下面有子栏目,那么它调用的就是栏目首页模板(category_为前缀的模板). 所以,当你这个栏目添 ...
- 如何查看编译安装的lnmp环境各自的配置参数
安装好后如何查看mysql/apache/nginx/php安装参数 查看mysql编译参数: cat /usr/local/mysql/bin/mysqlbug | grep CONFIGURE ...
- Jquery 小技巧
[每个程序员都会的35个jQuery的小技巧]收集的35个jQuery的小技巧/代码片段,可以帮你快速开发
- Android之下拉刷新的ListView
不废话,代码里面注释很详细,直接上代码: 自定义的RefreshableListView代码: public class RefreshableListView extends ListView im ...
- Bootstrap table使用心得
序号显示带分页信息的连续编号,在序号列添加以下格式化代码即可. { field: 'number', title: '序号', align:'center', width:45, formatter: ...
- KMP模板
参考:http://www.cnblogs.com/c-cloud/p/3224788.html #include<stdio.h> #include<string.h> vo ...
- 数据库操作,jdbc的CRUD
用Java代码操作数据库,可以用JDBC.首先要加载驱动,之后建立连接,再然后就可以对数据库进行操作. 1.建立连接.此处用的是MySQL数据库 public class DBUtil { publi ...
- libvirt 网络手册(二):桥接网络
原文:Bridged Network 在一个桥接网络里面,宿主机和虚拟机共享物理网卡.每一个虚拟机可以直接绑定任意可用的IPV4或IPV6局域网地址,就像一个物理机一样.桥接给libvirt网络提供最 ...