【iOS学习】十一、ActionSheet
2016-03-18 14:46
531 查看
ActionSheet
(1)实现协议在头文件中遵守UIActionSheetDelegate协议。
@interface ActionSheetTest : UIView<UIActionSheetDelegate>
(2)定义
UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:nil // 标题 delegate:self // 代理 cancelButtonTitle:@"取消" // 取消,系统自带 destructiveButtonTitle:nil // 确定,系统自带 otherButtonTitles:@"是",@"否", nil]; // 自定义其它选项 // actionSheet的样式 // UIActionSheetStyleBlackOpaque 不透明的深色样式 // UIActionSheetStyleBlackTranslucent 半透明的深色样式 // UIActionSheetStyleAutomatic 如果屏幕底部有按钮栏,则采用与按钮栏匹配的样式 actionSheet.actionSheetStyle = UIActionSheetStyleDefault; // 利用tag标记多个ActionSheet actionSheet.tag = 100;
(3)点击响应
-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex { if (actionSheet.tag == 100) { if (buttonIndex == 0) { NSLog("你点击了是"); } if (buttonIndex == 1) { NSLog("你点击了否"); } } }
相关文章推荐
- iOS边练边学--简单的数据操作(增、删、改),左滑动删除和弹窗
- iOS-代码修改Info.plist文件
- iOS应用程序生命周期(前后台切换,应用的各种状态)详解[转]
- nagios-安装配置
- IOSGCD
- ios: Base SDK和Deployment Target
- ios 模态半透明弹出框
- iOS 证书
- 【整理】BIOS、BootLoader、uboot对比
- ios 字符串转date,模拟器ok,真机不ok,
- iOS核心动画高级技巧一
- iOS计时器NSTimer的使用
- nagios监控系统安装
- iOS-----About Asset Catalog
- nagios短信监控
- ios开发中,联系人列表是怎样通过名字排序分组的(支持中文排序)
- IOS项目自动生成技术文档很方便实用
- iOS模拟Tom猫的简单界面
- iOS下bound,center和frame
- iOS cocoapods的详解大全及其flex