UIAlertView、UIActionSheet
2015-04-21 12:06
267 查看
*初始化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
(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 8 中 UIAlertView 和 UIActionSheet 河里去了?
- iOS8.0 之后UIAlertView和UIActionSheet的创建方式的新变化
- iOS开发 提示框- UIAlertController(是UIAlertView和UIActionSheet的合二为一)
- Iphone之UIAlertView和UIActionSheet
- 【IOS 开发学习总结-OC-47】★ios开发之UI控件——UIAlertView与 UIActionSheet
- 介绍UIALertView和UIActionSheet的用法。
- UIAlertView和UIActionSheet
- 【学习ios之路:UI系列】UIAlertView. UIActionSheet 和 UIAlertController
- iOS UIAlertController弹框(OS9.0 后替代UIAlertView弹框和UIActionSheet下弹框)
- UI控件篇——UIActionSheet(操作表)和UIAlertView(警告框)
- UIAlertView、UIActionSheet
- IOS UIAlertController 弹框 (ios 9.0 后代替了UIAlertView弹框 和 UIActionSheet下弹框)
- UIAlertView及UIActionSheet 在ios8极其以下版本的兼容问题解决方案
- UI29_UIAlertAction(UIAlertView和UIActionSheet的结合体)
- 自定义UIAlertView、UIActionSheet,高仿系统UIAlertView、UIActionSheet
- ios-消息弹框之UIAlertView, UIActionSheet以及UIAlertController小结
- UIAlertController UIAlertAction (UIAlertView, UIActionSheet)
- 谈谈改变 UIAlertView 和 UIActionSheet 的颜色
- iOS开发之如何自定义UIActionSheet(UIAlertView)中的内容
- iOS开发6:UIActionSheet与UIAlertView