FWAlertAction

@interface FWAlertAction : NSObject <NSCopying>

+ (instancetype)actionWithTitle:(nullable NSString *)title style:(FWAlertActionStyle)style handler:(void (^ __nullable)(FWAlertAction *action))handler;
+ (instancetype)actionWithTitle:(nullable NSString *)title style:(FWAlertActionStyle)style appearance:(nullable FWAlertControllerAppearance *)appearance handler:(void (^ __nullable)(FWAlertAction *action))handler;

/** action的标题 */
@property(nullable, nonatomic, copy) NSString *title;
/** action的富文本标题 */
@property(nullable, nonatomic, copy) NSAttributedString *attributedTitle;
/** action的图标,位于title的左边 */
@property(nullable, nonatomic, copy) UIImage *image;
/** title跟image之间的间距 */
@property (nonatomic, assign) CGFloat imageTitleSpacing;
/** 渲染颜色,当外部的图片使用了UIImageRenderingModeAlwaysTemplate时,使用该属性可改变图片的颜色 */
@property (nonatomic, strong) UIColor *tintColor;
/** 是否能点击,默认为YES */
@property(nonatomic, getter=isEnabled) BOOL enabled;
/** action的标题颜色,这个颜色只是普通文本的颜色,富文本颜色需要用NSForegroundColorAttributeName */
@property(nonatomic, strong) UIColor *titleColor;
/** action的标题字体,如果文字太长显示不全,会自动改变字体自适应按钮宽度,最多压缩文字为原来的0.5倍封顶 */
@property(nonatomic, strong) UIFont *titleFont;
/** action的标题的内边距,如果在不改变字体的情况下想增大action的高度,可以设置该属性的top和bottom值,默认UIEdgeInsetsMake(0, 15, 0, 15) */
@property(nonatomic, assign) UIEdgeInsets titleEdgeInsets;

/** 样式 */
@property(nonatomic, readonly) FWAlertActionStyle style;
/** 自定义样式,默认为样式单例 */
@property (nonatomic, strong, readonly) FWAlertControllerAppearance *alertAppearance;

@end

Undocumented

  • Undocumented

    Declaration

    Objective-C

    + (instancetype)actionWithTitle:(nullable NSString *)title style:(FWAlertActionStyle)style handler:(void (^ __nullable)(FWAlertAction *action))handler;
  • Undocumented

    Declaration

    Objective-C

    + (instancetype)actionWithTitle:(nullable NSString *)title style:(FWAlertActionStyle)style appearance:(nullable FWAlertControllerAppearance *)appearance handler:(void (^ __nullable)(FWAlertAction *action))handler;
  • action的标题

    Declaration

    Objective-C

    @property (nonatomic, copy, nullable) NSString *title;
  • action的富文本标题

    Declaration

    Objective-C

    @property (nonatomic, copy, nullable) NSAttributedString *attributedTitle;
  • action的图标,位于title的左边

    Declaration

    Objective-C

    @property (nonatomic, copy, nullable) UIImage *image;
  • title跟image之间的间距

    Declaration

    Objective-C

    @property (nonatomic) CGFloat imageTitleSpacing;
  • 渲染颜色,当外部的图片使用了UIImageRenderingModeAlwaysTemplate时,使用该属性可改变图片的颜色

    Declaration

    Objective-C

    @property (nonatomic, strong) UIColor *_Nonnull tintColor;
  • 是否能点击,默认为YES

    Declaration

    Objective-C

    @property (nonatomic, getter=isEnabled) BOOL enabled;
  • action的标题颜色,这个颜色只是普通文本的颜色,富文本颜色需要用NSForegroundColorAttributeName

    Declaration

    Objective-C

    @property (nonatomic, strong) UIColor *_Nonnull titleColor;
  • action的标题字体,如果文字太长显示不全,会自动改变字体自适应按钮宽度,最多压缩文字为原来的0.5倍封顶

    Declaration

    Objective-C

    @property (nonatomic, strong) UIFont *_Nonnull titleFont;
  • action的标题的内边距,如果在不改变字体的情况下想增大action的高度,可以设置该属性的top和bottom值,默认UIEdgeInsetsMake(0, 15, 0, 15)

    Declaration

    Objective-C

    @property (nonatomic) UIEdgeInsets titleEdgeInsets;
  • 样式

    Declaration

    Objective-C

    @property (nonatomic, readonly) FWAlertActionStyle style;
  • 自定义样式,默认为样式单例

    Declaration

    Objective-C

    @property (nonatomic, strong, readonly) FWAlertControllerAppearance *_Nonnull alertAppearance;