mirror of
https://github.com/lifution/FSPopoverView.git
synced 2026-10-29 12:40:09 +08:00
29 lines
804 B
Objective-C
29 lines
804 B
Objective-C
|
|
|
|
#import "PopoverAction.h"
|
|
|
|
@interface PopoverAction ()
|
|
|
|
@property (nonatomic, strong, readwrite) UIImage *image; ///< 图标
|
|
@property (nonatomic, copy, readwrite) NSString *title; ///< 标题
|
|
@property (nonatomic, copy, readwrite) void(^handler)(PopoverAction *action); ///< 选择回调
|
|
|
|
@end
|
|
|
|
@implementation PopoverAction
|
|
|
|
+ (instancetype)actionWithTitle:(NSString *)title handler:(void (^)(PopoverAction *action))handler {
|
|
return [self actionWithImage:nil title:title handler:handler];
|
|
}
|
|
|
|
+ (instancetype)actionWithImage:(UIImage *)image title:(NSString *)title handler:(void (^)(PopoverAction *action))handler {
|
|
PopoverAction *action = [[self alloc] init];
|
|
action.image = image;
|
|
action.title = title ? : @"";
|
|
action.handler = handler ? : NULL;
|
|
|
|
return action;
|
|
}
|
|
|
|
@end
|