UIAlertView、UIActionSheet
来源:互联网 发布:小米快传 mac 编辑:程序博客网 时间:2024/05/21 11:28
*初始化Action Sheet 和 Alert 并显示在屏幕上
(1)initWithTitle: 设置标题,将会显示在Alert 的顶部
UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle: @"Do you like 蓝鸥?" delegate: self cancelButtonTitle: @"Bye Bye" destrutiveButtonTitle: @"Yes, I like!" otherButtonTitles: @" ", nil];
[actionSheet showInView: self.view];
(2)Alert
UIAlertView *alert = [[UIAlertView alloc] initWithTitle: @"通知" message: @"涨工资了"
delegate: selfcancelButtonTitle: @"取消" otherButtonTitles: nil];
[alert show];
基本属性
1、创建Action Sheet需要多个参数
(1)initWithTitle: 设置标题,将会显示在Action Sheet 的顶部;
(2)delegate: 设置Action Sheet的一个按钮被按下后,它的delegagte将会被通知,并且这个delegate的actionSheet: didDismissWithButtonIndex方法将会执行。这里,我们将delegate设成self,这个可以保证执行我们自己在ViewController.m 写的 actionSheet: didDismissWithButtonIndex 方法。
(3)cancelButtonTitle: 设置取消按钮的标题,这个取消按钮将会显示在Action Sheet 的最下边。
(4)destructiveButtonTitle: 设置第一个确定按钮的标题,这个按钮可以理解成:“好的,继续”。
(5)otherButtonTitles: 可以设置任意多的确定按钮,想要添加两个按钮,可以写成:otherButtonTitles: @"New Button1", @"New Button2", nil
2、创建一个Alert 也要填写很多参数
(1)initWithTitle: 设置标题,将会显示在Alert 的顶部
(2)message: 设置提示消息内容
(3)delegate: 设置Alert 的委托,这里,我们设成self
(4)cancelButtonTitle: 设置取消按钮的标题
(5)otherButtonTitles: 与Action Sheet 类似
(6)[alert show]这条语句用来显示Alert
转自《蓝鸥科技iOS开发指南》
- UIAlertview UIActionSheet
- UIAlertView&UIActionSheet
- UIAlertView、UIActionSheet
- UIAlertView、UIActionSheet
- UIAlertView,UIActionSheet, UIMenuController
- UIAlertView vs UIActionSheet
- UIActionSheet与UIAlertView
- UIActionSheet与UIAlertView
- UIActionSheet与UIAlertView
- UIAlertView、UIActionSheet兼容iOS8
- UIActionSheet与UIAlertView
- IOS-UIAlertView和UIActionSheet
- UIActionSheet和UIAlertView
- UIAlertView和UIActionSheet
- UIAlertView,UIActionSheet的使用
- UIAlertView和UIActionSheet
- UIActionSheet and UIAlertView
- UIActionSheet and UIAlertView
- Cocos2d-x 3.0final 终结者系列教程22Cocos Studio动画编辑器的帧动画和骨骼动画详解
- C语言选择排序算法(升序)
- 【POJ2392】Space Elevator
- MySQL数据库的客户端安装----->NavicatforMySQL和SQLyog_Enterprise
- IDEA下Maven依赖包下载不下来的问题解决方案
- UIAlertView、UIActionSheet
- C语言冒泡排序算法(升序)
- ThinkPHP使用步骤
- 【源码】c#编写的安卓客户端与Windows服务器程序进行网络通信
- 当今最流行的Node.js应用开发框架简介
- UVA - 11464 Even Parity 枚举
- OC取字符串操作的方法
- 不小心使用Hibernate 導致Data 變更
- USACO Superprime Rib