Contents

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 don’t 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

Managing state