IOS9+基础之警报框弹出和操作表弹出
IOS9+基础之警报框弹出和操作表弹出
代码如下
//
// ViewController.m
// 001-UIAlertView
//
// Created by lujun on 2021/6/3.
//#import "ViewController.h"@interface ViewController ()
- (IBAction)rightClick:(id)sender;@end@implementation ViewController- (IBAction)clck2:(id)sender {// UIAlertView * alert = [[UIAlertView alloc] initWithTitle:@"标题" message:@"消息" delegate:self cancelButtonTitle:@"取消按钮" otherButtonTitles:@"其他按钮标题", nil];
//
// [alert show];//1.创建UIAlertControlerUIAlertController *alert = [UIAlertController alertControllerWithTitle:@"标题" message:@"这是一些信息" preferredStyle:UIAlertControllerStyleAlert];/*参数说明:Title:弹框的标题message:弹框的消息内容preferredStyle:弹框样式:UIAlertControllerStyleAlert*///2.添加按钮动作//2.1 确认按钮UIAlertAction *conform = [UIAlertAction actionWithTitle:@"确认" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {NSLog(@"点击了确认按钮");}];//2.2 取消按钮UIAlertAction *cancel = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {NSLog(@"点击了取消按钮");}];//2.3 还可以添加文本框 通过 alert.textFields.firstObject 获得该文本框
// [alert addTextFieldWithConfigurationHandler:^(UITextField * _Nonnull textField) {// textField.placeholder = @"请填写您的反馈信息";
// }];//3.将动作按钮 添加到控制器中[alert addAction:conform];[alert addAction:cancel];//4.显示弹框[self presentViewController:alert animated:YES completion:nil];}- (IBAction)leftClick:(id)sender {// UIAlertView * alert = [[UIAlertView alloc] initWithTitle:@"标题" message:@"消息" delegate:self cancelButtonTitle:@"取消按钮" otherButtonTitles:@"其他按钮标题", nil];
//
// [alert show];//1.创建UIAlertControlerUIAlertController *alert = [UIAlertController alertControllerWithTitle:@"标题" message:@"这是一些信息" preferredStyle:UIAlertControllerStyleAlert];/*参数说明:Title:弹框的标题message:弹框的消息内容preferredStyle:弹框样式:UIAlertControllerStyleAlert*///2.添加按钮动作//2.1 确认按钮UIAlertAction *conform = [UIAlertAction actionWithTitle:@"确认" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {NSLog(@"点击了确认按钮");}];//2.2 取消按钮UIAlertAction *cancel = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {NSLog(@"点击了取消按钮");}];//2.3 还可以添加文本框 通过 alert.textFields.firstObject 获得该文本框[alert addTextFieldWithConfigurationHandler:^(UITextField * _Nonnull textField) {textField.placeholder = @"请填写您的反馈信息";}];//3.将动作按钮 添加到控制器中[alert addAction:conform];[alert addAction:cancel];//4.显示弹框[self presentViewController:alert animated:YES completion:nil];}- (void)viewDidLoad {[super viewDidLoad];}- (IBAction)rightClick:(id)sender {//1.创建ControllerUIAlertController *alertSheet = [UIAlertController alertControllerWithTitle:@"标题" message:@"一些信息" preferredStyle:UIAlertControllerStyleActionSheet];/*参数说明:Title:弹框的标题message:弹框的消息内容preferredStyle:弹框样式:UIAlertControllerStyleActionSheet*///2.添加按钮动作UIAlertAction *action1 = [UIAlertAction actionWithTitle:@"项目1" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {NSLog(@"点击了项目1");}];UIAlertAction *action2 = [UIAlertAction actionWithTitle:@"项目2" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {NSLog(@"点击了项目2");}];UIAlertAction *cancel = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {NSLog(@"点击了取消");}];//3.添加动作[alertSheet addAction:action1];[alertSheet addAction:action2];[alertSheet addAction:cancel];//4.显示sheet[self presentViewController:alertSheet animated:YES completion:nil];}
@end
IOS9+基础之警报框弹出和操作表弹出相关推荐
- html登入弹框插件,基于jQuery的弹出框插件
html如下: $(function() { $("#btn01").popwin({ element: "#box01", title: "请填写以 ...
- vb屏蔽文本框点右键时的弹出菜单
----------以下代码在模块 程序代码: Option Explicit Public Declare Function SetWindowLong Lib "user32" ...
- iOS项目中一定会用到的两种常用的弹框 从底部弹出 、中间弹出 Swift代码
从底部弹出的弹框 ,样式如下 1.利用CocoaPods导入HWPanModal 框架,在桥接文件中导入头文件 #import "HWPanModal.h" 2.创建一个新的控制器 ...
- Vue 实现弹框自由拖拽(不出可视范围、解决快速拖动问题)
Vue 实现弹框自由拖拽(不出可视范围.解决快速拖动问题) 由于页面中弹框很多,往往会挡住想要查看的内容.从而,有了自由移动拖拽弹框的需求:但在使用的过程中发现,一开始编写的drag.js文件会移出可 ...
- 个人中心 (二) 01-编辑资料-基础布局-Popup弹出层-底部弹出-头像男女时间 DatetimePicker时间选择转换-dayjs(value).format('YYYY-MM-DD')
个人中心-编辑资料-基础布局-Popup 弹出层-底部弹出模式-头像-男女-时间 & DatetimePicker 时间选择-年月日模式 & dayjs(value) 转换成日期对象, ...
- android点击按钮弹出输入框,android 弹出框(输入框和选择框)
1.输入框: final EditText inputServer = new EditText(this); inputServer.setFilters(new InputFilter[]{new ...
- pythonselenium浮动框_python上selenium的弹框操作实现
selenium之弹框操作 1,分类 弹框类型自见解分为四种: 1,页面弹框 2,警告提示框(alert) 3,确认消息框(confirm) 4,提示消息对话(prompt) 提示: selenium ...
- html制作单选网页程序,网页制作基础:单选框和复选框的应用_html
在用表单设计调查表时,为了减少用户的操作,使用选择框是一个好主意,在html的标记中有两种选择框,即单选框和复选框,两者的区别是单选框中的选项用户只能选择一项,而复选框中的选项用户可以任意选择多项,甚 ...
- Vue消息弹窗不重复弹出,只弹出一次
消息弹窗不重复弹出,只弹出一次 文章借鉴:让ElementUI Message消息提示每次只弹出一次 1.在utils里新建一个message.js 文件 /*** 重置message,防止重复点击重 ...
最新文章
- 下载备忘:甘特图实现的代码
- 计算机视觉不可能凉!
- 虚拟机使用的是此版本 VMware Workstation 不支持的硬件版本。 模块“Upgrade”启动失败。 未能启动虚拟机(修改.vmx文件virtualHW.version = “xx“字段)
- Centos 利用yum源安装 nginx stream模块
- vuecli4 启动_vue 常见命令 (启动 部署)
- Win11如何切换应用商店网络 Win11切换应用商店网络的方法
- linux语言yhq,linux通过docker安装kafka
- 朋友圈最忌讳发什么?
- 超过 1 亿 Android 用户的数据遭泄露!
- try catch和if else
- 前端两种播放视频的方式
- 吉米多维奇数学分析习题集每日一题--泰勒公式习题1377
- csf播放器(csf播放器ios)
- wifi android kernel,android wifi 驱动框架简介
- 吉他指弹入门——日式指弹的pm技巧
- ecshop模板支持php,解决ecshop模板不支持php代码,修改ecshop过滤模板php代码!
- 复星打造的外滩新地标--BFC外滩金融中心将于12月12日正式开业
- html——简单文章发布html页面及富文本编辑器wangEditor的使用
- 从MySQL数据库中查询某个数据库某个表中字段
- css适配iphonex底部安全区
热门文章
- 数字图像处理与python实现 pdf_正版 数字图像处理与Python实现 高等院校计算机科学 人工智能 信号与信息处理 通信工程等专业的...
- 的训练过程_指外翻的人在训练的过程中,要不要拉伸收肌?
- paging in linux,Linux Operating System
- ios 直播点赞_微信新版本更新:为视频号直播虚拟礼物,还提供连麦、美颜等功能...
- 1029mysql_今日编码学习(1029)
- 计算平均指令时间_为什么向量化计算(vectorization)会这么快?
- python怎么读取word文件_python之python-docx编辑和读取word文档
- 【C语言笔记】关于数组的一个陷阱!
- c语言类型名占字节,C语言实现 数据类型占多少字节指针占多少字节
- Java excel 比较_java 实现两excel(或csv)文件的比对(以某几列作为键值,比对指定列的值差异)...