Instance Property

isSelected

A Boolean value indicating whether the control is in the selected state.

Declaration

var isSelected: Bool { get set }

Discussion

Set the value of this property to true to select it or false to deselect it. Most controls do not modify their appearance or behavior when selected, but some do. For example, the UISegmentedControl class tracks whether a segment is selected and draws it differently when it is.

The default value of this property is false for a newly created control. You can set a control’s initial selected state in your storyboard file.

See Also

Configuring the Control’s Attributes

var state: UIControl.State

The state of the control, specified as a bitmask value.

var isEnabled: Bool

A Boolean value indicating whether the control is enabled.

var isHighlighted: Bool

A Boolean value indicating whether the control draws a highlight.

var contentVerticalAlignment: UIControl.ContentVerticalAlignment

The vertical alignment of content within the control’s bounds.

enum UIControl.ContentVerticalAlignment

Constants for specifying the vertical alignment of content (text and images) in a control.

var contentHorizontalAlignment: UIControl.ContentHorizontalAlignment

The horizontal alignment of content within the control’s bounds.

var effectiveContentHorizontalAlignment: UIControl.ContentHorizontalAlignment

The horizontal alignment currently in effect for the control.

enum UIControl.ContentHorizontalAlignment

The horizontal alignment of content (text and images) within a control.