iOS Developer Library — Pre-Release

Developer

UIKit User Interface Catalog

PDF

Label

Label Attributes Inspector Reference

image: ../Art/uilabel_attributes_inspector.pdf

Text and Behavior

image: ../Art/uilabel_attributes_inspector_group-text_layout_behavior.pdf

Lines

The maximum number of lines for the label text.

Set to 0 for an unlimited number of lines.

Access: numberOfLines.

Text

Text Type

The type of the label text.

Selection

Plain

Attributed

Text Type: Plain

This group configures the label plain text.

image: ../Art/uilabel_attributes_inspector_subgroup-text-plain.pdf

Text

The label plain text.

Access: text.

Color

The color of the label plain text.

Access: textColor.

Font

The font of the label plain text.

Access: font.

Alignment

The alignment of the label plain text.

Text Type: Attributed

This group configures the text selected in Attributed Text.

image: ../Art/uilabel_attributes_inspector_subgroup-text-attributed.pdf

Attributed Text Layout

The alignment and other layout characteristics of the selected attributed text.

To set alignment and other layout characteristics of part of the attributed text in code, you need to create an attributed string with the desired characteristics and assign it to attributedText.

Selection

image: ../Art/xcode_icon-text_align_left.pdf Left

image: ../Art/xcode_icon-text_align_center.pdf Center

image: ../Art/xcode_icon-text_align_right.pdf Right

image: ../Art/xcode_icon-text_align_justified.pdf Justified

image: ../Art/xcode_icon-text_align_natural.pdf Natural

image: ../Art/xcode_icon-text_attributes_color.pdf Text Color

image: ../Art/xcode_icon-text_attributes_background_color.pdf Background Color

image: ../Art/xcode_icon-text_attributes_more.pdf More

Font

The font of the selected attributed text.

Access: font.

Attributed Text

The label attributed text.

Access: attributedText.

Behavior

Enabled

Whether the label is enabled.

Selection

Method

Argument

image: ../Art/user_interface_checkbox-unselected.pdf Unselected

enabled

NO

image: ../Art/user_interface_checkbox-selected.pdf Selected

enabled

YES

Highlighted

Whether the label is highlighted.

Toggle this property after setting the text highlight color to preview the highlighted label.

Selection

Method

Argument

image: ../Art/user_interface_checkbox-unselected.pdf Unselected

highlighted

NO

image: ../Art/user_interface_checkbox-selected.pdf Selected

highlighted

YES

Text Baseline and Line Breaks

image: ../Art/uilabel_attributes_inspector_group-textbaseline_linebreaks.pdf

Baseline

How to adjust the text baseline so that the text fits in the label.

Line Breaks

The line break mode of the label text.

Text Sizing

image: ../Art/uilabel_attributes_inspector_group-textsizing.pdf

Autoshrink

How to shrink the label text so that it fits in the label.

Selection

Method

Argument

Method

Fixed Font Size

adjustsFontSizeToFitWidth

NO

Minimum Font Scale

adjustsFontSizeToFitWidth

YES

minimumScaleFactor

Minimum Font Size

adjustsFontSizeToFitWidth

YES

minimumFontSize

Tighten Letter Spacing

Whether to reduce the label text letter spacing so that it fits in the label.

Selection

Method

Argument

image: ../Art/user_interface_checkbox-unselected.pdf Unselected

adjustsLetterSpacingToFitWidth

NO

image: ../Art/user_interface_checkbox-selected.pdf Selected

adjustsLetterSpacingToFitWidth

YES

Text Highlight and Shadow

image: ../Art/uilabel_attributes_inspector_group-texthighlight_shadow.pdf

Highlighted

The color for the label text when the label is highlighted.

This property applies only to plain text labels.

Access: highlightedTextColor.

Shadow

The color of the label text shadow.

Access: shadowColor.

Shadow Offset

The offset of the label text shadow.

Access: shadowOffset.