UIKit框架 - 06.UIActionSheet使用
2015-07-13 21:50
483 查看
1.UIAcitonSheet概述
有时候我们希望提示框或弹窗能从底部弹出,苹果耶提供了这么一个类来实现这个功能功能显示
2.代码实现
这里我们实现基本功能,点击屏幕弹框出现,点击按钮,弹框消失弹框上设置了3个按钮
注意:与UIAlertView类不同,UIAcitonSheet不能添加文本框
-(void)touchesBegan:(nonnull NSSet<UITouch *> *)touches withEvent:(nullable UIEvent *)event{ // 1.创建UIActionSheet UIActionSheet *sheet = [[UIActionSheet alloc] initWithTitle:@"哥是标题" delegate:self cancelButtonTitle:@"取消" destructiveButtonTitle:@"确认" otherButtonTitles:@"Other", nil]; // 2.显示到视图上 [sheet showInView:self.view]; } // 监听按钮点击事件 // 只要UIActionSheet上的按钮被点击就会调用 // actionSheet:谁触发事件就会把谁传递进来 // clickedButtonAtIndex:当前被点击按钮的索引 #pragma mark - UIActionSheetDelegate -(void)actionSheet:(nonnull UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex{ // 0.确认按钮,Other是取消按钮,2是取消按钮 NSLog(@"%ld被点击了",buttonIndex); }
相关文章推荐
- vs2013错误,错误 1 error MSB8020: The build tools for Visual Studio 2012
- Win7安vc2008编译报LINK : fatal error LNK1000: Internal error during IncrBuildImage
- Android(java)学习笔记127:Android Studio新建工程中的build.gradle、settings.gradle
- IOS UITableView 概述
- UIKit框架-05.UIAlertView使用
- Android(java)学习笔记126:Android Studio中build.gradle简介
- 代码手写UI、xib和storyboard各自的局限性
- UICollectionView-使用Flow Layout
- IOS UI设计模式 - 分页
- amaze ui 的使用
- 浅谈C#多线程与UI响应
- AndroidAnnotations框架@Ebean,@RootContext,@Background,@UiThread,@AfterInject,@AfterTextChange标签的使用方法
- easyui中datagrid和layout的问题
- hdu 4908 BestCoder Sequence 发现M中值是字符串数, 需要预处理
- NGUI ScrollView总结
- EasyUI-DataGrid多线动态实现选择性合并
- IOS中 什么是UITableView的索引放大镜字符
- Java-BlockingQueue的使用
- UI_Singleton(单例传值)
- N-Queens II 回溯法求八皇后