NSAttributedString(Extensions) Category Reference

Declared in NSAttributedString+Extensions.h

Overview

NSAttributedString extensions.

+ attributedStringWithString:

Creates a new NSAttributedString.

+ (nonnull NSAttributedString *)attributedStringWithString:(nonnull NSString *)string

Parameters

string

The character string.

Return Value

The NSAttributedString object.

Declared In

NSAttributedString+Extensions.h

+ attributedStringWithString:attributes:

Creates a new NSAttributedString.

+ (nonnull NSAttributedString *)attributedStringWithString:(nonnull NSString *)string attributes:(nullable NSDictionary<NSString*,id> *)attributes

Parameters

string

The character string.

attributes

The attributes to be applied to the string.

Return Value

The NSAttributedString object.

Declared In

NSAttributedString+Extensions.h

– sizeWithContainer:

Calculates the CGSize that would be required to render this NSAttributedString given the container CGSize.

- (CGSize)sizeWithContainer:(CGSize)container

Parameters

container

The size in which attempt to fit the text.

Return Value

The CGSize required to render.

Declared In

NSAttributedString+Extensions.h

– sizeWithContainer:lineBreakMode:

Calculates the CGSize that would be required to render this NSAttributedString given the container CGSize.

- (CGSize)sizeWithContainer:(CGSize)container lineBreakMode:(NSLineBreakMode)lineBreakMode

Parameters

container

The size in which attempt to fit the text.

lineBreakMode

The NSLineBreakMode to use when laying out the text.

Return Value

The CGSize required to render.

Declared In

NSAttributedString+Extensions.h

– sizeWithContainer:lineBreakMode:padding:

Calculates the CGSize that would be required to render this NSAttributedString given the container CGSize.

- (CGSize)sizeWithContainer:(CGSize)container lineBreakMode:(NSLineBreakMode)lineBreakMode padding:(UIEdgeInsets)padding

Parameters

container

The size in which attempt to fit the text.

lineBreakMode

The NSLineBreakMode to use when laying out the text.

padding

The padding to apply to the container before calculating.

Return Value

The CGSize required to render.

Declared In

NSAttributedString+Extensions.h