UIActionSheet学习
2015-06-14 18:17
411 查看
UIActionSheet是在iOS弹出的选择按钮项,可以添加多项,并为每项添加点击事件。
要遵循UIActionSheetDelegate协议;
需#import<UIKit/UIKit.h>
需注意:
Important:
deprecated in iOS 8. (Note that
also deprecated.) To create and manage action sheets in iOS 8 and later, instead use
a
如上所示,在IOS8.0及以后 版本中不再支持UIActionSheet,以后的研究下用UIAlertController实现的方法。
重要的属性及方法:
- (instancetype)initWithTitle:(NSString *)title//标题
delegate:(id<UIActionSheetDelegate>)delegate//委托对象,需满足UIActionSheetDelegate协议,可设为nil
cancelButtonTitle:(NSString *)cancelButtonTitle//取消标题
destructiveButtonTitle:(NSString *)destructiveButtonTitle//‘确认’标题
otherButtonTitles:(NSString *)otherButtonTitles//其他按钮标题,可以是一组
, …
//构造方法
@property(nonatomic, copy) NSString *title
//标题;
@property(nonatomic) UIActionSheetStyle actionSheetStyle
//显示风格,可选项如下
UIActionSheetStyleAutomatic=-1
UIActionSheetStyleDefault=UIBarStyleDefault
UIActionSheetStyleBlackTranslucent=UIBarStyleBlackTranslucent
UIActionSheetStyleBlackOpaque=UIBarStyleBlackOpaque
- (NSInteger)addButtonWithTitle:(NSString *)title
//增加一个按钮
@property(nonatomic, readonly) NSInteger numberOfButtons//按钮总数,意义不大
@property(nonatomic) NSInteger cancelButtonIndex//取消按钮的序号,可用来确定当按下是不是取消按钮
@property(nonatomic) NSInteger destructiveButtonIndex//‘确认’按钮序号,可用来确定当按下是不是‘确认’按钮
- (void)showInView:(UIView *)view
// view The view from which the action sheet originates.
常用委托方法:
- (void)actionSheet:(UIActionSheet *)actionSheet
didDismissWithButtonIndex:(NSInteger)buttonIndex
Parameters
要遵循UIActionSheetDelegate协议;
需#import<UIKit/UIKit.h>
需注意:
Important:
UIActionSheetis
deprecated in iOS 8. (Note that
UIActionSheetDelegateis
also deprecated.) To create and manage action sheets in iOS 8 and later, instead use
UIAlertControllerwith
a
preferredStyleof
UIAlertControllerStyleActionSheet.
如上所示,在IOS8.0及以后 版本中不再支持UIActionSheet,以后的研究下用UIAlertController实现的方法。
重要的属性及方法:
- (instancetype)initWithTitle:(NSString *)title//标题
delegate:(id<UIActionSheetDelegate>)delegate//委托对象,需满足UIActionSheetDelegate协议,可设为nil
cancelButtonTitle:(NSString *)cancelButtonTitle//取消标题
destructiveButtonTitle:(NSString *)destructiveButtonTitle//‘确认’标题
otherButtonTitles:(NSString *)otherButtonTitles//其他按钮标题,可以是一组
, …
//构造方法
@property(nonatomic, copy) NSString *title
//标题;
@property(nonatomic) UIActionSheetStyle actionSheetStyle
//显示风格,可选项如下
UIActionSheetStyleAutomatic=-1
UIActionSheetStyleDefault=UIBarStyleDefault
UIActionSheetStyleBlackTranslucent=UIBarStyleBlackTranslucent
UIActionSheetStyleBlackOpaque=UIBarStyleBlackOpaque
- (NSInteger)addButtonWithTitle:(NSString *)title
//增加一个按钮
@property(nonatomic, readonly) NSInteger numberOfButtons//按钮总数,意义不大
@property(nonatomic) NSInteger cancelButtonIndex//取消按钮的序号,可用来确定当按下是不是取消按钮
@property(nonatomic) NSInteger destructiveButtonIndex//‘确认’按钮序号,可用来确定当按下是不是‘确认’按钮
- (void)showInView:(UIView *)view
// view The view from which the action sheet originates.
常用委托方法:
- (void)actionSheet:(UIActionSheet *)actionSheet
didDismissWithButtonIndex:(NSInteger)buttonIndex
Parameters
actionSheet | The action sheet that was dismissed. |
buttonIndex | The index of the button that was clicked. The button indices start at 0. If this is the cancel button index, the action sheet is canceling. If -1, the cancel button index is not set. |
相关文章推荐
- 线程安全的BlockingQueue
- iOS程序的启动过程-UIWindow
- loadrunner生成随机uuid的方法
- 黑马程序员——GUI1:上篇
- RequestDispatcher跳转后的乱码问题
- 使用 UICollectionView 实现网格化视图效果
- The project was not built since its build path is incomplete. Cannot fin
- 对于dequeueReusableCellWithIdentifier:的理解
- UIImage 读取图片内存优化
- Atitit.ui控件---下拉菜单选择控件的实现select html
- Atitit.ui控件---下拉菜单选择控件的实现select html
- Qt 5.5 beta - Qt Quick Extras - CircularGauge
- AsyncDisplayKit -- ( facebook/新浪微博 ) 优化UI性能
- Unique Binary Search Trees-LeetCode
- poj2284 That Nice Euler Circuit(欧拉定理+枚举)
- How To Use Coordinates To Extract Sequences In Fasta File
- Leetcode: Implement Stack using Queues
- Android ActivityThread(主线程或UI线程)简介
- UIScrollView的contentSize与contentOffset
- jquerr对象的height()/innerHeight()/outerHeight()/outerHeight(true)区别