// // MTActionSheet.h // Meet // // Created by ko1o, on 2018/10/16. // Copyright © 2018年 Food. All rights reserved. // #import typedef NS_ENUM(NSUInteger, MTActionSheetButtonType) { MTActionSheetButtonTypeNormal, MTActionSheetButtonTypeCancel, MTActionSheetButtonTypeDestructive, }; @class MTActionSheet; @interface MTActionSheetButton : UIButton + (instancetype)buttonWithType:(MTActionSheetButtonType)type title:(NSString *)title; @end @protocol MTActionSheetDelegate @optional // Called when a button is clicked. The view will be automatically dismissed after this call returns - (void)actionSheet:(MTActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger)buttonIndex; - (void)actionSheetDidDismiss:(MTActionSheet *)actionSheet; //完全消失后回调,比如点击空白区域消失的情况 @end @interface MTActionSheet : UIView @property (nonatomic, strong) UILabel *titleLabel; @property (nonatomic, weak) id delegate; - (instancetype)initWithTitle:(nullable NSString *)title delegate:(nullable id)delegate cancelButtonTitle:(nullable NSString *)cancelButtonTitle destructiveButtonTitle:(nullable NSString *)destructiveButtonTitle otherButtonTitles:(nullable NSString *)otherButtonTitles, ... NS_REQUIRES_NIL_TERMINATION; - (NSInteger)addButtonWithTitle:(nullable NSString *)title; // returns index of button. 0 based. - (void)show; - (void)showInView:(UIView *)view; - (void)dismiss; @property (nonatomic, strong) void(^onDidDismiss)(MTActionSheet *sheet); @property (nonatomic, strong) void(^onClickAction)(MTActionSheet *sheet, NSInteger buttonIndex); @end