ios基础控件UIAlertView与UIActionSheet
来源:互联网 发布:mysql 有符号整型 编辑:程序博客网 时间:2024/06/16 20:53
1.UIAlertView
首先来看下UIAlertView的实现效果图:
第一步通过点击外部按钮弹出提醒对话框
- (IBAction)showAlertView:(id)sender { UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"标题" message:@"提醒内容" delegate:self cancelButtonTitle:@"NO" otherButtonTitles:@"YES", nil]; [alert show];}
#pragma mark - UIAlertViewDelegate- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{ NSLog(@"%ld", buttonIndex);}
2.UIActionSheet
首先来看下UIActionSheet实现的效果图
第一步给外部的按钮增加点击事件弹出操作表
- (IBAction)openActionSheet:(id)sender { UIActionSheet *sheet = [[UIActionSheet alloc] initWithTitle:@"标题" delegate:self cancelButtonTitle:@"取消" destructiveButtonTitle:@"破坏" otherButtonTitles:@"其它", nil]; [sheet showInView:self.view];}
第二步监听各个按钮点击事件
#pragma mark - UIActionSheetDelegate- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex { NSLog(@"%ld", buttonIndex); NSString *title = [actionSheet buttonTitleAtIndex:buttonIndex]; NSLog(@"您点击了:%@", title);}
注:以上两个控件在监听内部按钮点击响应事件时,都需要添加代理协议:
@interface OtherViewController ()<UIAlertViewDelegate, UIActionSheetDelegate>@end
0 0
- ios基础控件UIAlertView与UIActionSheet
- IOS提示控件UIActionSheet,UIAlertView
- IOS提示控件UIActionSheet,UIAlertView
- iOS开发:UIActionSheet与UIAlertView
- [iOS] iPhone常用控件、UIActionSheet、UIAlertView
- iOS开发6:UIActionSheet与UIAlertView
- iOS UIAlertController代替代替UIAlertView与UIActionSheet
- iOS基础控件---UIAlertView
- IOS-UIAlertView和UIActionSheet
- IOS之UIActionSheet& UIAlertView
- UIActionSheet与UIAlertView
- UIActionSheet与UIAlertView
- UIActionSheet与UIAlertView
- UIActionSheet与UIAlertView
- IOS基础UI之(五)UIAlertView、UIActionSheet和UIAlertController详解
- 【IOS 开发学习总结-OC-47】★ios开发之UI控件——UIAlertView与 UIActionSheet
- iPhone常用控件、UIActionSheet、UIAlertView
- iPhone常用控件、UIActionSheet、UIAlertView
- android全局Dialog
- QAbstractListModel:Qml 使用C++model
- Same Tree
- JProfiler使用详细教程学习笔记
- git提交代码
- ios基础控件UIAlertView与UIActionSheet
- 沙盒结构&常见的文件存储方式
- 05:字符环
- ubuntu 16.04 无法挂起休眠等问题
- java读写文件(可指定编码)
- 这是一篇原创的微博
- Java解读内存,优化编程
- iOS深入学习(创建静态库static library)
- swift 错误集合 ------>持续更新中