setAction(_:forSegmentAt:)
Sets the action for the segment at the index you specify.
Declaration
func setAction(_ action: UIAction, forSegmentAt segment: Int)Parameters
- action:
A Uiaction object to set on the segment at the index you specify.
- segment:
An integer index of a segment.
Discussion
Segments prefer images over titles when the action contains both. Selecting a segment invokes the action’s UIActionHandler, as well as handlers for the valueChanged and primaryActionTriggered control events.