UIButton(FWUIKit)
@interface UIButton (FWUIKit)
/// 自定义按钮禁用时的alpha,如0.5,默认0不生效
@property (nonatomic, assign) CGFloat fw_disabledAlpha NS_REFINED_FOR_SWIFT;
/// 自定义按钮高亮时的alpha,如0.5,默认0不生效
@property (nonatomic, assign) CGFloat fw_highlightedAlpha NS_REFINED_FOR_SWIFT;
/// 快速设置文本按钮
- (void)fw_setTitle:(nullable NSString *)title font:(nullable UIFont *)font titleColor:(nullable UIColor *)titleColor NS_REFINED_FOR_SWIFT;
/// 快速设置文本
- (void)fw_setTitle:(nullable NSString *)title NS_REFINED_FOR_SWIFT;
/// 快速设置图片
- (void)fw_setImage:(nullable UIImage *)image NS_REFINED_FOR_SWIFT;
/// 设置图片的居中边位置,需要在setImage和setTitle之后调用才生效,且button大小大于图片+文字+间距
///
/// imageEdgeInsets: 仅有image时相对于button,都有时上左下相对于button,右相对于title
/// titleEdgeInsets: 仅有title时相对于button,都有时上右下相对于button,左相对于image
- (void)fw_setImageEdge:(UIRectEdge)edge spacing:(CGFloat)spacing NS_REFINED_FOR_SWIFT;
/// 设置状态背景色
- (void)fw_setBackgroundColor:(nullable UIColor *)backgroundColor forState:(UIControlState)state NS_REFINED_FOR_SWIFT;
/// 快速创建文本按钮
+ (instancetype)fw_buttonWithTitle:(nullable NSString *)title font:(nullable UIFont *)font titleColor:(nullable UIColor *)titleColor NS_REFINED_FOR_SWIFT;
/// 快速创建图片按钮
+ (instancetype)fw_buttonWithImage:(nullable UIImage *)image NS_REFINED_FOR_SWIFT;
@end
Undocumented
-
自定义按钮禁用时的alpha,如0.5,默认0不生效
Declaration
Objective-C
@property (nonatomic) CGFloat fw_disabledAlpha;
-
自定义按钮高亮时的alpha,如0.5,默认0不生效
Declaration
Objective-C
@property (nonatomic) CGFloat fw_highlightedAlpha;
-
快速设置文本按钮
Declaration
Objective-C
- (void)fw_setTitle:(nullable NSString *)title font:(nullable UIFont *)font titleColor:(nullable UIColor *)titleColor;
-
快速设置文本
Declaration
Objective-C
- (void)fw_setTitle:(nullable NSString *)title;
-
快速设置图片
Declaration
Objective-C
- (void)fw_setImage:(nullable UIImage *)image;
-
设置图片的居中边位置,需要在setImage和setTitle之后调用才生效,且button大小大于图片+文字+间距
imageEdgeInsets: 仅有image时相对于button,都有时上左下相对于button,右相对于title titleEdgeInsets: 仅有title时相对于button,都有时上右下相对于button,左相对于image
Declaration
Objective-C
- (void)fw_setImageEdge:(UIRectEdge)edge spacing:(CGFloat)spacing;
-
设置状态背景色
Declaration
Objective-C
- (void)fw_setBackgroundColor:(nullable UIColor *)backgroundColor forState:(UIControlState)state;
-
快速创建文本按钮
Declaration
Objective-C
+ (nonnull instancetype)fw_buttonWithTitle:(nullable NSString *)title font:(nullable UIFont *)font titleColor:(nullable UIColor *)titleColor;
-
快速创建图片按钮
Declaration
Objective-C
+ (nonnull instancetype)fw_buttonWithImage:(nullable UIImage *)image;