Declared in UILabel+BFKit.h

Overview

This category adds some useful methods to UILabel

Tasks

Class Methods

initWithFrame:text:font:size:color:alignment:lines:

+ (UILabel *_Nonnull)initWithFrame:(CGRect)frame text:(NSString *_Nonnull)text font:(FontName)fontName size:(CGFloat)size color:(UIColor *_Nonnull)color alignment:(NSTextAlignment)alignment lines:(NSInteger)lines
Discussion

Create an UILabel with the given parameters, with clearColor for the shadow

Parameters

frame

Label’s frame

text

Label’s text

fontName

Label’s font name, FontName enum is declared in UIFont+BFKit

size

Label’s font size

color

Label’s text color

alignment

Label’s text alignment

lines

Label’s text lines

Return Value

Returns the created UILabel

Declared In

UILabel+BFKit.h

initWithFrame:text:font:size:color:alignment:lines:shadowColor:

+ (UILabel *_Nonnull)initWithFrame:(CGRect)frame text:(NSString *_Nonnull)text font:(FontName)fontName size:(CGFloat)size color:(UIColor *_Nonnull)color alignment:(NSTextAlignment)alignment lines:(NSInteger)lines shadowColor:(UIColor *_Nonnull)colorShadow
Discussion

Create an UILabel with the given parameters

Parameters

frame

Label’s frame

text

Label’s text

fontName

Label’s font name, FontName enum is declared in UIFont+BFKit

size

Label’s font size

color

Label’s text color

alignment

Label’s text alignment

lines

Label’s text lines

colorShadow

Label’s text shadow color

Return Value

Returns the created UILabel

Declared In

UILabel+BFKit.h

Instance Methods

calculatedHeight

- (CGFloat)calculatedHeight
Discussion

Calculates height based on text, width and font

Return Value

Returns calculated height

Declared In

UILabel+BFKit.h

setFont:fromIndex:toIndex:

- (void)setFont:(UIFont *_Nonnull)font fromIndex:(NSInteger)fromIndex toIndex:(NSInteger)toIndex
Discussion

Sets a custom font from a character at an index to character at another index

Parameters

font

New font to be setted

fromIndex

The start index

toIndex

The end index

Declared In

UILabel+BFKit.h