UIAlertController 输入文本框
来源:互联网 发布:17网广州网络批发市场 编辑:程序博客网 时间:2024/05/20 11:24
//初始化提示框;
UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"商品费用" message:nil preferredStyle:UIAlertControllerStyleAlert];
[alert addTextFieldWithConfigurationHandler:^(UITextField * _Nonnull textField) {
textField.placeholder = @"请输入商费,可参考收银小票";
textField.keyboardType = UIKeyboardTypeDecimalPad;
}];
//添加一个确定按钮 并获取AlertView中的第一个输入框 将其文本赋值给BUTTON的title
[alert addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
UITextField *envirnmentNameTextField = alert.textFields.firstObject;
NSLog(@"你输入的文本======%@",envirnmentNameTextField.text);
}]];
[alert addAction:[UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
}]];
//弹出提示框;
[self presentViewController:alert animated:true completion:nil];
UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"商品费用" message:nil preferredStyle:UIAlertControllerStyleAlert];
[alert addTextFieldWithConfigurationHandler:^(UITextField * _Nonnull textField) {
textField.placeholder = @"请输入商费,可参考收银小票";
textField.keyboardType = UIKeyboardTypeDecimalPad;
}];
//添加一个确定按钮 并获取AlertView中的第一个输入框 将其文本赋值给BUTTON的title
[alert addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
UITextField *envirnmentNameTextField = alert.textFields.firstObject;
NSLog(@"你输入的文本======%@",envirnmentNameTextField.text);
}]];
[alert addAction:[UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
}]];
//弹出提示框;
[self presentViewController:alert animated:true completion:nil];
阅读全文
0 0
- UIAlertController 输入文本框
- 加上输入框的UIAlertController
- UIAlertController 自定义输入框及KVO监听
- UIAlertController 自定义输入框及KVO监听
- 使用 UIAlertController 创建多个输入框
- iOS UIAlertController警告框 添加输入框
- UIAlertController
- UIAlertController
- UIAlertController
- UIAlertController
- UIAlertController
- UIalertController
- UIAlertController
- UIalertController
- UIAlertController
- UIAlertController
- UIAlertController
- UIAlertController
- TensorFlow实战:Chapter-8上(Mask R-CNN介绍与实现)
- 次序关系
- C++类模板
- 单链表和顺序表的逆置问题
- 学习问题:图像内插-最近邻内插法
- UIAlertController 输入文本框
- 数据结构实验之二叉树五:层序遍历
- 容器stack的函数
- 对数线性模型之一(逻辑回归), 广义线性模型学习总结
- 【MyCpp_1】读取数量不定的输入数据
- BZOJ2208 [Jsoi2010]连通数
- 在Metasploit中连接数据库
- 异步调用 promise 的用法
- dfs深度优先搜图操作