UIActionSheet/ UIAlaterView/UIAlertController
来源:互联网 发布:centos 安装 分区 编辑:程序博客网 时间:2024/06/06 07:43
UIActionSheet/ UIAlaterView 的区别是,
1 一个在屏幕底部弹出, 一个在屏幕正中间弹出.
2 按钮的序号不同. UIActionSheet 按钮的序号, 是从上往下, 依次 0,1,2…. UIAlaterView 按钮的序号 是 cancelButtonTitle是0 otherButtonTitles是 从1,2,3…
// 弹出来alertview ios7 以后中的另一种写法
//UIAlertControllerStyleAlert 可以选择是在底部,还是屏幕中间
UIAlertController *vc = [UIAlertController alertControllerWithTitle:@”提示” message:@”指纹识别” preferredStyle:UIAlertControllerStyleAlert];
//添加按钮
UIAlertAction *action1 = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:nil]; [vc addAction:action1];
//红色字体的
UIAlertAction *action2 = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDestructive handler:^(UIAlertAction *action) { NSLog(@"queding"); }]; [vc addAction:action2]; [self presentViewController:vc animated:YES completion:nil];
通讯录 04 通讯录注销 第4分钟
在底部弹出一个警示框, 用于给用户提供选项, 如QQ 点击退出时在底部弹出的 确定/ 取消/ 退出后接收消息.
- (IBAction)logout:(id)sender {
UIActionSheet *sheet = [[UIActionSheet alloc] initWithTitle:@”提示” delegate:self cancelButtonTitle:@”取消” destructiveButtonTitle:@”确定” otherButtonTitles:nil, nil];
//显示
[sheet showInView:self.view];
遵守代理 实现代理方法, 可以对点击按钮后进行对应操作.
pragma mark - actionSheet的代理方法
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex{ if (buttonIndex == 0) { //点了确定按钮 排序,从上往下 0,1,2….. [self.navigationController popViewControllerAnimated:YES]; }}
在屏幕正中央,弹出一个提示框,
UIAlertView *alertView = [[UIAlertView alloc]initWithTitle:@"提示 " message:@"退出QQ ?" delegate:self cancelButtonTitle:@"不退出" otherButtonTitles:@"退出",@"暂停", nil]; [alertView show];
可以是两个选项, 也可以是三个选项.
UIAlaterView 按钮的序号(buttonIndex) 是 cancelButtonTitle(不退出)是0 otherButtonTitles是 从1,2,3…
代理方法
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{ NSLog(@"点击了%ld",(long)buttonIndex);}
0 0
- UIActionSheet/ UIAlaterView/UIAlertController
- UIAlertController(UIActionSheet、UIAlertView)
- UIAlertController UIAlertAction (UIAlertView, UIActionSheet)
- UIAlertController(UIAlertView && UIActionSheet)
- iOS 10 UIActionSheet UIAlertController
- iOS开发-UIActionSheet和UIAlertController
- UIAlertController,取代UIAlertView和UIActionSheet
- iOS8 UIAlertController 创建UIAlertView以及UIActionSheet
- Swift之使用UIAlertController实现UIActionsheet
- UIAlertController replaces the UIActionSheet and UIAlertView
- UIAlertController UIAlertAction (UIAlertView, UIActionSheet)(最好)
- 【UI进阶】UIAlertController替代UIAlertView和UIActionSheet
- UIAlertController VS UIAlertView and UIActionSheet
- UIKit-UIAlertView,UIActionSheet,UIAlertController使用方法(完整版)
- IOS-UIAlertController(UIAlertView和UIActionSheet二合一)
- UIAlertController进行代替UIAlterView和UIActionSheet
- UIAlertController + UIAlertView + UIActionSheet 弹框显示工具
- iOS UIAlertController代替代替UIAlertView与UIActionSheet
- eclipse闪退
- 图片下拉放大 自定义scrollView
- ubuntu 下su root 失败su: Authentication failure
- 细节记录
- mysql之select 查询表数据(一)
- UIActionSheet/ UIAlaterView/UIAlertController
- Linux内核之BUS驱动设备模型理解
- php中引入facebook的messenger消息接口
- Java 多线程(四) 多线程访问成员变量与局部变量
- c语言的四个标准
- maven项目少lang的包
- 二分法学习总结
- MySql创建表
- 三星遭遇2016