一个类似微信 ActionSheet 的弹出框.
支持 AutoLayout 和屏幕旋转适配
CocoaPods 是推荐安装 MessageDisplayKit 的方法,只需在 Podfile
中添加以下行
支持 CocoaPods。只需在 Podfile
文件中添加一行
pod 'LYActionSheet'
然后运行 pod install
,即可完成安装。
接下来,在终端中输入 pod install
即可
易于添加到您的项目中。
该库易于接入项目
1、导入 LYActionSheet 头文件。
1.导入头文件 LYActionSheet.h
#import "LYActionSheet.h"
2、初始化 LYActionSheet 类。本库提供了四种初始化方法。
2.本库提供了四种初始化方法
- (instancetype)initWithButtonTitles:(NSString *)otherButtonTitles, ... NS_REQUIRES_NIL_TERMINATION;
- (instancetype)initWithCancelButtonTitle:(NSString *)cancelButtonTitle otherButtonTitles:(NSString *)otherButtonTitles, ... NS_REQUIRES_NIL_TERMINATION;
- (instancetype)initWithCancelButtonTitle:(NSString *)cancelButtonTitle otherButtonTitles:(NSString *)otherButtonTitles, ... NS_REQUIRES_NIL_TERMINATION;
- (instancetype)initWithTitle:(NSString *)title cancelButtonTitle:(NSString *)cancelButtonTitle destructiveButtonTitle:(NSString *)destructiveButtonTitle otherButtonTitles:(NSString *)otherButtonTitles, ... NS_REQUIRES_NIL_TERMINATION;
3、显示 actionSheet,当用户点击按钮时会调用 block。
3.调用显示弹框。用户点击选项按钮时 block 会调用。
- (void)showWithClickedButtonAtIndex:(void(^)(NSInteger buttonIndex, NSString *buttonTitle))clickedBlock;
- (void)showWithClickedButtonAtIndex:(void(^)(NSInteger buttonIndex, NSString *buttonTitle))clickedBlock cancel:(void(^)(NSString *buttonTitle))cancelBlock;