UIAlertView、UIActionSheet
2015-02-24 12:21
330 查看
*初始化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开发指南》
(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开发指南》
相关文章推荐
- UIAlertControl的使用对比与UIAlertView和UIActionSheet
- iPhone起步-2:iPhone常用控件、UIActionSheet、UIAlertView (转)
- UIActionSheet/ UIAlaterView/UIAlertController
- iOS UIAlertController 弹框 (ios 9.0 后代替了UIAlertView弹框 和 UIActionSheet下弹框)
- UIAlertView、 UIActionSheet
- iOS 8 中 UIAlertView 和 UIActionSheet 河里去了?
- UIAlertController UIAlertAction (UIAlertView, UIActionSheet)(最好)
- Swift基础(二十二)UIAlertView,UIActionSheet,UIAlertController
- 【UIAlertView警报和UIActionSheet操作表】
- iOS8以后UIAlertView和UIActionSheet两种alert页面都将通过UIAlertController来创建
- UIAlertView、UIActionSheet
- IOS UIAlertView 和 UIActionSheet的区别
- UIView、UIResponder、UIAlertView、UIActionSheet
- IOS问题汇总:2012-12-18 UIAlertView+UIActionSheet
- UIActionSheet与UIAlertView
- ios-day05-05(创建弹框(对话框),UIAlertView、UIActionSheet)
- iOS8 UIAlertController 创建UIAlertView以及UIActionSheet
- iOS UIAlertView 和 UIActionSheet 的使用
- 给UIAlertView UIActionSheet 添加block支持
- 提醒用户_UIAlertview/UIActionsheet