UIKit框架 - 06.UIActionSheet使用
来源:互联网 发布:2007-2017年的网络热词 编辑:程序博客网 时间:2024/06/15 17:33
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);}
0 0
- UIKit框架 - 06.UIActionSheet使用
- UIKit框架-高级控件Swift版本: 7.UIActionSheet方法/属性详解
- UIKit框架
- UIKit框架
- UIKit框架
- UIKit框架-05.UIAlertView使用
- UIKit框架-07.UIAlertController使用
- UIKit框架- 08.UIScrollView基本使用
- UIKit-UIAlertView,UIActionSheet,UIAlertController使用方法(完整版)
- UIActionSheet 使用
- 使用UIActionSheet
- UIActionSheet使用
- UIKit框架-高级控件:6.UIPickerView与UIImageView结合使用
- UIKit框架-高级控件:8.UIPickerView, UILabel, UIImageView结合使用
- 【UIkit】-8-UIActionSheet - 底部弹出提示,快要被取代
- UIKit框架的介绍
- UIKit框架的介绍
- UIKit框架简介
- 过滤NSString中的Emoji
- icvGetTrainingDataCallback源码详细分析
- 用flvplayer.swf在网页中播放视频(网页中flash视频播放的实现)
- 1003. Emergency (25)
- Game Programming Patterns-目录
- UIKit框架 - 06.UIActionSheet使用
- 我不知道自己为何又写文字
- CentOS 7 折腾小记
- 欢迎使用CSDN-markdown编辑器
- js String对象
- 走一程山水,参一段云烟
- 建立String对象
- Trunk 配置
- HTML5选择器