当前位置: 首页 > news >正文

ios 对话框 弹框,输入对话框 普通对话框

1 普通对话框

  UIAlertController* alert = [UIAlertController alertControllerWithTitle:@"a"                                                                    message:@"alert12222fdsfs"                                                       preferredStyle:UIAlertControllerStyleAlert];     UIAlertAction* defaultAction = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefaulthandler:^(UIAlertAction * action) {}];UIAlertAction* cancelAction = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleDefault                                                        handler:^(UIAlertAction * action) {}];[alert addAction:defaultAction];[alert addAction:cancelAction];[self presentViewController:alert animated:YES completion:nil];

在这里插入图片描述

2 输入对话框

 //对话框添加文本输入框UIAlertController* alert = [UIAlertController alertControllerWithTitle:@"标题"message:@"啊啊啊啊啊"preferredStyle:UIAlertControllerStyleAlert];UIAlertAction* okAction = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefaulthandler:^(UIAlertAction * action) {//得到文本信息  进行后续处理for(UITextField *text in alert.textFields){NSLog(@"text = %@", text.text);}}];UIAlertAction* cancelAction = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancelhandler:^(UIAlertAction * action) {//响应事件NSLog(@"action = %@", alert.textFields);}];[alert addTextFieldWithConfigurationHandler:^(UITextField *textField) {textField.placeholder = @"用户名";}];[alert addTextFieldWithConfigurationHandler:^(UITextField *textField) {textField.placeholder = @"密码";textField.secureTextEntry = YES;}];[alert addAction:okAction];[alert addAction:cancelAction];[self presentViewController:alert animated:YES completion:nil];

在这里插入图片描述

3 密码输入对话框

 UIAlertView *alertView = [[UIAlertView alloc]initWithTitle:@"支付" message:@"10.0" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确定", nil];alertView.alertViewStyle = UIAlertViewStyleSecureTextInput;[alertView show];

在这里插入图片描述

4 UIAlertController显示ActionSheet

    //弹出框列表选择UIAlertController* alert = [UIAlertController alertControllerWithTitle:@"aa"message:@"Ta a a a "preferredStyle:UIAlertControllerStyleActionSheet];UIAlertAction* cancelAction = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancelhandler:^(UIAlertAction * action) {}];UIAlertAction* deleteAction = [UIAlertAction actionWithTitle:@"删除" style:UIAlertActionStyleDestructivehandler:^(UIAlertAction * action) {}];UIAlertAction* saveAction = [UIAlertAction actionWithTitle:@"保存" style:UIAlertActionStyleDefaulthandler:^(UIAlertAction * action) {}];[alert addAction:saveAction];[alert addAction:cancelAction];[alert addAction:deleteAction];[self presentViewController:alert animated:YES completion:nil];

在这里插入图片描述

UIAlertView早应该被废弃了,别用…

http://www.lryc.cn/news/229640.html

相关文章:

  • (论文阅读23/100)Hierarchical Convolutional Features for Visual Tracking
  • 基于IGT-DSER智能网关实现GE的PAC/PLC与罗克韦尔(AB)的PLC之间通讯
  • 创建符合 Web 可访问性标准的 HTML 布局
  • SQL学习(CTFhub)整数型注入,字符型注入,报错注入 -----手工注入+ sqlmap注入
  • 数字人部署之VITS+Wav2lip数据流转处理以提高实时性
  • GPT 学习法:复杂文献轻松的完美理解、在庞大的不确性中找到确定性
  • 前端简单的爱心形状
  • acwing算法基础之数学知识--求数a的欧拉函数值phi(a)
  • Jenkins的介绍与相关配置
  • 开源网安受邀参加网络空间安全合作与发展论坛,为软件开发安全建设献计献策
  • arcgis提取栅格有效边界
  • 后端接口性能优化分析-问题发现问题定义
  • 中国首个通过ASIL D认证的IP发布,国产芯片供应商的机会来了
  • [单片机课程设计报告汇总] 单片机设计报告常用硬件元器件描述
  • Docker学习——⑧
  • 力扣刷题第二十一天--栈与队列
  • Python基础-解释器安装
  • MySQL(14):视图
  • Blazor 附件上传和下载功能
  • Git 安装配置
  • Center Smoothing Certified Robustness for Networks with Structured Outputs
  • C#几种截取字符串的方法
  • 【PG】PostgreSQL高可用方案repmgr部署(非常详细)
  • Linux Makefile配置问题
  • k8s篇之underlay网络和overlay区别
  • 掉瓶子小游戏
  • Elasticsearch7 入门 进阶
  • 你是怎么封装微信小程序的数据请求的?
  • C++ vector中capacity()和size() 的区别
  • 【Redis】redis-server和redis-cli