Instance Property

textAlignment

The technique to use for aligning the text.

Declaration

@property(nonatomic) NSTextAlignment textAlignment;

Discussion

If you are using styled text, assigning a new value to this property causes the text alignment to be applied to the entirety of the string in the attributedText property. If you want to apply the alignment to only a portion of the text, create a new attributed string with the desired style information and associate it with the label. If you are not using styled text, this property applies to the entire text string in the text property.

In iOS 9 and later, the default value of this property is NSTextAlignmentNatural; prior to iOS 9, the default value was NSTextAlignmentLeft.

See Also

Accessing the Text Attributes

text

The current text that is displayed by the label.

attributedText

The current styled text that is displayed by the label.

font

The font used to display the text.

textColor

The color of the text.

lineBreakMode

The technique to use for wrapping and truncating the label’s text.

enabled

The enabled state to use when drawing the label’s text.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software