Declared in UIView+Initializers.h
UIView+Initializers.m

Overview

Introduces initializer helpers UIView.

Class Methods

viewWithFrame:

Creates and returns a newly allocated view object with the specified frame rectangle.

+ (instancetype)viewWithFrame:(CGRect)frame

Parameters

frame

The frame rectangle for the view, measured in points. The origin of the frame is relative to the superview in which you plan to add it. This method uses the frame rectangle to set the center and bounds properties accordingly.

Return Value

An initialized view object or nil if the object couldn’t be created.

Declared In

UIView+Initializers.h

viewWithFrame:backgroundColor:

Initializes and returns a newly allocated view object with the specified frame rectangle and background color.

+ (instancetype)viewWithFrame:(CGRect)frame backgroundColor:(UIColor *)backgroundColor

Parameters

frame

The frame rectangle for the view, measured in points. The origin of the frame is relative to the superview in which you plan to add it. This method uses the frame rectangle to set the center and bounds properties accordingly.

backgroundColor

The views background color.

Return Value

An initialized view object or nil if the object couldn’t be created.

Declared In

UIView+Initializers.h

viewWithFrame:backgroundColor:cornerRadius:

Creates and returns a newly allocated view object with the specified frame rectangle and background color.

+ (instancetype)viewWithFrame:(CGRect)frame backgroundColor:(UIColor *)backgroundColor cornerRadius:(CGFloat)cornerRadius

Parameters

frame

The frame rectangle for the view, measured in points. The origin of the frame is relative to the superview in which you plan to add it. This method uses the frame rectangle to set the center and bounds properties accordingly.

backgroundColor

The views background color.

cornerRadius

The corner radius of the view.

Return Value

An initialized view object or nil if the object couldn’t be created.

Declared In

UIView+Initializers.h

viewWithFrame:backgroundColor:cornerRadius:borderColor:borderWidth:

Creates and returns a newly allocated view object with the specified frame rectangle and background color.

+ (instancetype)viewWithFrame:(CGRect)frame backgroundColor:(UIColor *)backgroundColor cornerRadius:(CGFloat)cornerRadius borderColor:(UIColor *)borderColor borderWidth:(CGFloat)borderWidth

Parameters

frame

The frame rectangle for the view, measured in points. The origin of the frame is relative to the superview in which you plan to add it. This method uses the frame rectangle to set the center and bounds properties accordingly.

backgroundColor

The views background color.

cornerRadius

The corner radius of the view.

borderColor

The border color of the view.

borderWidth

The border width.

Return Value

An initialized view object or nil if the object couldn’t be created.

Declared In

UIView+Initializers.h

Instance Methods

initWithFrame:backgroundColor:

Creates and returns a newly allocated view object with the specified frame rectangle and background color.

- (instancetype)initWithFrame:(CGRect)frame backgroundColor:(UIColor *)backgroundColor

Parameters

frame

The frame rectangle for the view, measured in points. The origin of the frame is relative to the superview in which you plan to add it. This method uses the frame rectangle to set the center and bounds properties accordingly.

backgroundColor

The views background color.

Return Value

An initialized view object or nil if the object couldn’t be created.

Declared In

UIView+Initializers.h

initWithFrame:backgroundColor:cornerRadius:

Initializes and returns a newly allocated view object with the specified frame rectangle and background color.

- (instancetype)initWithFrame:(CGRect)frame backgroundColor:(UIColor *)backgroundColor cornerRadius:(CGFloat)cornerRadius

Parameters

frame

The frame rectangle for the view, measured in points. The origin of the frame is relative to the superview in which you plan to add it. This method uses the frame rectangle to set the center and bounds properties accordingly.

backgroundColor

The views background color.

cornerRadius

The corner radius of the view.

Return Value

An initialized view object or nil if the object couldn’t be created.

Declared In

UIView+Initializers.h

initWithFrame:backgroundColor:cornerRadius:borderColor:borderWidth:

Initializes and returns a newly allocated view object with the specified frame rectangle and background color.

- (instancetype)initWithFrame:(CGRect)frame backgroundColor:(UIColor *)backgroundColor cornerRadius:(CGFloat)cornerRadius borderColor:(UIColor *)borderColor borderWidth:(CGFloat)borderWidth

Parameters

frame

The frame rectangle for the view, measured in points. The origin of the frame is relative to the superview in which you plan to add it. This method uses the frame rectangle to set the center and bounds properties accordingly.

backgroundColor

The views background color.

cornerRadius

The corner radius of the view.

borderColor

The border color of the view.

borderWidth

The border width.

Return Value

An initialized view object or nil if the object couldn’t be created.

Declared In

UIView+Initializers.h