iOS9 之后的UIAlertView 的写法
2015-11-03 15:44
585 查看
iOS9之前 的UIAlertView
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示" message:message delegate:self cancelButtonTitle:@"确定"
otherButtonTitles: nil];
[alert show];
iOS9 之后的UIAlertView
UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"提示" message:@"注册成功"
preferredStyle:UIAlertControllerStyleAlert];
//取消
UIAlertAction *cacelAction = [UIAlertAction actionWithTitle:@"返回" style:UIAlertActionStyleCancel handler:nil];
[alert addAction:cacelAction];
//确认
UIAlertAction *okAction = [UIAlertAction actionWithTitle:@"好的" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull
action) {
NSLog(@"你好啊");
}];
[alert addAction:okAction];
[self presentViewController:alert animated:YES completion:nil];
这里我试了初始化 action 的顺序,但是无法改变它们显示出来的顺序,依然是 先有取消 再有 确认键
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示" message:message delegate:self cancelButtonTitle:@"确定"
otherButtonTitles: nil];
[alert show];
iOS9 之后的UIAlertView
UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"提示" message:@"注册成功"
preferredStyle:UIAlertControllerStyleAlert];
//取消
UIAlertAction *cacelAction = [UIAlertAction actionWithTitle:@"返回" style:UIAlertActionStyleCancel handler:nil];
[alert addAction:cacelAction];
//确认
UIAlertAction *okAction = [UIAlertAction actionWithTitle:@"好的" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull
action) {
NSLog(@"你好啊");
}];
[alert addAction:okAction];
[self presentViewController:alert animated:YES completion:nil];
这里我试了初始化 action 的顺序,但是无法改变它们显示出来的顺序,依然是 先有取消 再有 确认键
相关文章推荐
- UIActivityIndicatorView的使用说明
- Ant-------默认是build.xml 改为其他的名字
- 基于MVC4+EasyUI的Web开发框架经验总结(8)--实现Office文档的预览
- UITableView常用操作
- NSOperationQueue
- 锁表参数 enque/table_size via ECC6 EHP7
- 【UER #5】万圣节的南瓜灯
- UINavigationController层次关系
- Web Service单元测试工具实例介绍之SoapUI
- The project cannot be built until build path errors are resolved解决方案
- Longest Increasing Subsequence
- hdoj 3450 Counting Sequences 【离散化 + 树状数组优化dp】
- UISwipeGestureRecognizer手势识别
- UINavigationItem UINavigationBar 关系分析
- Ligerui表格基本操作(二)
- request.getRequestURL() getRequestURI区别
- UIButton (常用点击按钮)
- 关于安装WindowBuilder问题
- request.getSession(true)和request.getSession(false)的区别
- iOS9 系统分享调用之UIActivityViewController