iOS9 升级后UIAlertController的简单使用
来源:互联网 发布:怎么开发java手机游戏 编辑:程序博客网 时间:2024/05/19 23:27
#import "ViewController.h"@interface ViewController ()@end@implementation ViewController- (void)viewDidLoad { [super viewDidLoad]; UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom]; button.frame = CGRectMake(100, 100,100, 100); [button addTarget:self action:@selector(actionButton:) forControlEvents:UIControlEventTouchUpInside]; button.backgroundColor = [UIColor blueColor]; [self.view addSubview:button]; }- (void)actionButton:(UIButton *)button { UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"提示" message:@"开心" preferredStyle:UIAlertControllerStyleAlert]; UIAlertAction *okAction = [UIAlertAction actionWithTitle:@"确定" style:(UIAlertActionStyleDefault) handler:^(UIAlertAction * _Nonnull action) { NSLog(@"111"); }]; UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) { NSLog(@"222"); }]; [alertController addAction:okAction]; [alertController addAction:cancelAction]; [alertController addTextFieldWithConfigurationHandler:^(UITextField * _Nonnull textField) { textField.placeholder = @"用户名"; textField.secureTextEntry = YES; }]; [self presentViewController:alertController animated:YES completion:nil];}@end<img src="http://img.blog.csdn.net/20160207091452331?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast" alt="" />运行效果如下:
0 0
- iOS9 升级后UIAlertController的简单使用
- iOS9 UIAlertController简单使用代码
- UIAlertController的使用(ios9.0后代替UIAlertView与UIActionSheet)
- iOS9.0更新放弃AlertView后,开始使用UIAlertController
- UIAlertController的简单使用
- ios9新增 UIAlertController 简单用法
- iOS -iOS9中提示框(UIAlertController)的常见使用
- Xcode7 ios9 升级后出现的问题
- iOS9.0 升级后的常见问题
- UIAlertController的简单使用示例
- Swift - UIAlertController的简单使用
- xcode升级后ios9.0不能使用http协议的版本的解决方法介绍
- ios8.0后 UIAlertController的使用
- IOS9.0升级后以及xcode7后引起的问题
- 【iOS开发】CocoaPods下载、安装、更新、以及升级iOS9.0后源不可使用的解决方案
- iOS9关键字的简单使用
- UIAlertController和UIAlertAction的简单使用
- ios9 xcode7 UIAlertController的常用用法
- JSON解析
- hdoj 1596 find the safest road【最短路3种方法】
- PPAPI与Browser间使用AsyncIPC通信
- 人工智能、应用、程序
- 字符串替换-K&R C 题3-2
- iOS9 升级后UIAlertController的简单使用
- hdu 1325 Is It A Tree? 判断是否是树 巨坑
- poj3233 Matrix Power Series (矩阵快速幂+二分)
- 关于accept 返回的socket的阻塞属性
- setInterval和setTimeout
- JSP页面布局工具JWebBox升级到2.0版
- Tomcat配置环境变量
- noip2002-自由落体 2008.11.5
- 详解iOS7原生二维码,条码扫描