Declared in UIButton+BFKit.h

Overview

This category adds some useful methods to UIButton

Tasks

Class Methods

initWithFrame:

+ (instancetype _Nonnull)initWithFrame:(CGRect)frame
Discussion

Create an UIButton in a frame

Parameters

frame

Button’s frame

Return Value

Returns the UIButton instance

Declared In

UIButton+BFKit.h

initWithFrame:color:

+ (instancetype _Nonnull)initWithFrame:(CGRect)frame color:(UIColor *_Nonnull)color
Discussion

Create an UIButton in a frame with a color

Parameters

frame

Button’s frame

color

Button’s color, the highlighted color will be automatically created

Return Value

Returns the UIButton instance

Declared In

UIButton+BFKit.h

initWithFrame:color:highlightedColor:

+ (instancetype _Nonnull)initWithFrame:(CGRect)frame color:(UIColor *_Nonnull)color highlightedColor:(UIColor *_Nonnull)highlightedColor
Discussion

Create an UIButton in a frame with a color and highlighted color

Parameters

frame

Button’s frame

color

Button’s color

highlightedColor

Button’s highlighted color

Return Value

Returns the UIButton instance

Declared In

UIButton+BFKit.h

initWithFrame:image:

+ (instancetype _Nonnull)initWithFrame:(CGRect)frame image:(UIImage *_Nonnull)image
Discussion

Create an UIButton in a frame with an image

Parameters

frame

Button’s frame

image

Button’s image

Return Value

Returns the UIButton instance

Declared In

UIButton+BFKit.h

initWithFrame:image:highlightedImage:

+ (instancetype _Nonnull)initWithFrame:(CGRect)frame image:(UIImage *_Nonnull)image highlightedImage:(UIImage *_Nullable)highlightedImage
Discussion

Create an UIButton in a frame with an image

Parameters

frame

Button’s frame

image

Button’s image

highlightedImage

Button’s highlighted image

Return Value

Returns the UIButton instance

Declared In

UIButton+BFKit.h

initWithFrame:title:

+ (instancetype _Nonnull)initWithFrame:(CGRect)frame title:(NSString *_Nullable)title
Discussion

Create an UIButton in a frame with a title and a clear color

Parameters

frame

Button’s frame

title

Button’s title, the title color will be white

Return Value

Returns the UIButton instance

Declared In

UIButton+BFKit.h

initWithFrame:title:backgroundImage:

+ (instancetype _Nonnull)initWithFrame:(CGRect)frame title:(NSString *_Nullable)title backgroundImage:(UIImage *_Nullable)backgroundImage
Discussion

Create an UIButton in a frame with a title and a background image

Parameters

frame

Button’s frame

title

Button’s title

backgroundImage

Button’s background image

Return Value

Returns the UIButton instance

Declared In

UIButton+BFKit.h

initWithFrame:title:backgroundImage:highlightedBackgroundImage:

+ (instancetype _Nonnull)initWithFrame:(CGRect)frame title:(NSString *_Nullable)title backgroundImage:(UIImage *_Nullable)backgroundImage highlightedBackgroundImage:(UIImage *_Nullable)highlightedBackgroundImage
Discussion

Create an UIButton in a frame with a title, a background image and highlighted background image

Parameters

frame

Button’s frame

title

Button’s title

backgroundImage

Button’s background image

highlightedBackgroundImage

Button’s highlighted background image

Return Value

Returns the UIButton instance

Declared In

UIButton+BFKit.h

initWithFrame:title:color:

+ (instancetype _Nonnull)initWithFrame:(CGRect)frame title:(NSString *_Nonnull)title color:(UIColor *_Nonnull)color
Discussion

Create an UIButton in a frame with a title and a color

Parameters

frame

Button’s frame

title

Button’s title

color

Button’s color, the highlighted color will be automatically created

Return Value

Returns the UIButton instance

Declared In

UIButton+BFKit.h

initWithFrame:title:color:highlightedColor:

+ (instancetype _Nonnull)initWithFrame:(CGRect)frame title:(NSString *_Nonnull)title color:(UIColor *_Nonnull)color highlightedColor:(UIColor *_Nonnull)highlightedColor
Discussion

Create an UIButton in a frame with a title, a color and highlighted color

Parameters

frame

Button’s frame

title

Button’s title

color

Button’s color

highlightedColor

Button’s highlighted color

Return Value

Returns the UIButton instance

Declared In

UIButton+BFKit.h

Instance Methods

setTitleColor:

- (void)setTitleColor:(UIColor *_Nonnull)color
Discussion

Set the title color

Parameters

color

Font color, the highlighted color will be automatically created

Declared In

UIButton+BFKit.h

setTitleColor:highlightedColor:

- (void)setTitleColor:(UIColor *_Nonnull)color highlightedColor:(UIColor *_Nullable)highlightedColor
Discussion

Set the title color and highlighted color

Parameters

color

Button’s color

highlightedColor

Button’s highlighted color

Declared In

UIButton+BFKit.h

setTitleFont:size:

- (void)setTitleFont:(FontName)fontName size:(CGFloat)size
Discussion

Set the title font with a size

Parameters

fontName

Font name from the FontName enum declared in UIFont+BFKit

size

Font size

Declared In

UIButton+BFKit.h