ios 关于UIAlertView与UIActionSheet的区别,以及在使用过程中注意事项
来源:互联网 发布:java finally 放return 编辑:程序博客网 时间:2024/05/27 20:26
UIAlertView *alert =[[UIAlertView alloc] initWithTitle:@"hello" message:@"I'm Apple" delegate:self cancelButtonTitle:@"ok" otherButtonTitles:nil];[alert show];[alert release];
有多个按钮的时候
UIAlertView *alert =[[UIAlertView alloc] initWithTitle:@"hello" message:@"O哈啊" delegate:self cancelButtonTitle:@"ok" otherButtonTitles:@"cancel",@"Ignore",nil ];
UIAlertViewDelegate 中的
- (void) alertView:(UIAlertView *)alertview
clickedButtonAtIndex:(NSInteger)buttonIndex
方法可以知道你点的是那个按钮。
UIActionSheet是从屏幕底部弹起的一个模态对话框,它的使用也很简单
UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:@"Are you sure?" delegate:self cancelButtonTitle:@"No Way!" destructiveButtonTitle:@"Yes, I'm sure!" otherButtonTitles:nil]; [actionSheet showInView:self.view];
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex 代理方法,知道你点击了那个按钮
注意:在iphone和ipad上使用UIActionShee控件t的效果会不一样,在苹果的官方文档中有相关说明:
在ipad上使用UIActionSheet控件改控件不再从底部弹出,而是从屏幕中间弹出与UIAlertView警告框弹出有点类似。效果如图所示,cancelButton按钮文字显示不出来,destructiveButtonTitle按钮文字为红色加粗字体
1 0
- ios 关于UIAlertView与UIActionSheet的区别,以及在使用过程中注意事项
- UIAlertView,UIActionSheet的使用
- iOS开发:UIActionSheet与UIAlertView
- ios 9.0以后关于UIAlertView和 UIActionSheet使用的一些新的变化
- IOS开发之 ---- iOS8中提示框的使用UIAlertController(UIAlertView和UIActionSheet二合一)
- IOS开发之 ---- iOS8中提示框的使用UIAlertController(UIAlertView和UIActionSheet二合一)
- IOS开发之 ---- iOS8中提示框的使用UIAlertController(UIAlertView和UIActionSheet二合一)
- iOS学习笔记—— UIAlertView 和 UIActionSheet 的使用
- UIAlertController的使用(ios9.0后代替UIAlertView与UIActionSheet)
- iOS8中提示框的使用UIAlertController(UIAlertView和UIActionSheet)
- iOS UIAlertView使用注意事项
- iOS开发6:UIActionSheet与UIAlertView
- ios基础控件UIAlertView与UIActionSheet
- iOS UIAlertController代替代替UIAlertView与UIActionSheet
- iOS中UIActionSheet的使用
- iOS中UIActionSheet的使用
- iOS中UIActionSheet的使用
- iOS UIAlertView和UIActionSheet的用法
- leetcode编程题(4)Median of Two Sorted Arrays
- 多线程
- Disruptor入门
- 数据类型和引用类型的区别
- eyesight goodness
- ios 关于UIAlertView与UIActionSheet的区别,以及在使用过程中注意事项
- vss和vs2008搭建源代码管理服务器
- 编程小练习
- rally ---openstack 性能测试
- MySQL 时间戳(Timestamp)函数
- HTTP协议
- Javascript 面向对象编程
- 面向对象三大特性
- 求数据流中的中位数