iOS UIActionSheet提示框
2016-03-05 14:45
337 查看
之前做过一个项目使用最新的提示框4s会默然的崩溃,于是又修改成最原始的UIActionSheet
UIActionSheet使用情况具体如下
在对应的case中做相应的操作即可
UIActionSheet使用情况具体如下
#import "ViewController.h" @interface ViewController ()<UIActionSheetDelegate> @property (nonatomic, strong)UIButton *button; @end @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; self.button = [[UIButton alloc]init]; self.button.frame = CGRectMake(100, 100, 50, 30); self.button.backgroundColor = [UIColor redColor]; [self.button addTarget:self action:@selector(clicks:) forControlEvents:UIControlEventTouchUpInside]; [self.view addSubview:self.button]; } - (void)clicks:(UIButton *)button { UIActionSheet* actionSheet = [[UIActionSheet alloc] initWithTitle:@"请选择文件来源" delegate:self cancelButtonTitle:@"取消" destructiveButtonTitle:nil otherButtonTitles:@"照相机",@"摄像机",@"本地相簿",@"本地视频",nil]; [actionSheet showInView:self.view]; } - (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex { switch (buttonIndex) { case 0: { NSLog(@"2"); } break; case 1: { NSLog(@"2"); } break; case 2: { NSLog(@"2"); } break; case 3: { NSLog(@"4"); } break; default: break; } }
在对应的case中做相应的操作即可
相关文章推荐
- ugui 中有关grid layout group的适配问题
- UVA 10689 Yet another Number Sequence(矩阵快速幂求Fib数列)
- UVA 10689 Yet another Number Sequence(矩阵快速幂求Fib数列)
- UITapGestureRecognizer 的使用,判断点击哪个控件
- QuickSort 快排算法 java
- require笔札
- Handler中的四种更新UI写法
- poj--3061--Subsequence(贪心)
- poj--3061--Subsequence(贪心)
- UESTC 758-P酱的冒险旅途【BFS】
- 今日开讲—— easyui-combobox动态赋值
- LeetCode 51 - N-Queens II
- Ngui 拖拽到底部,直接循环到顶部
- Uva1594 Ducci Sequence
- poj Subsequence 3061 (高效&DP)
- LeetCode 51 - N-Queens
- Android几种在其他线程中更新UI的方法
- UUID 和 GUID 的区别
- UESTC P酱的冒险旅途 785 (规律模拟)
- 利用系统自带的UITabBarController纯代码搭建TabBar