Contents

insertSegment(action:at:animated:)

Insert a segment with the action you specify at the given index.

Declaration

func insertSegment(action: UIAction, at segment: Int, animated: Bool)

Parameters

  • action:

    A Uiaction object to set on the segment at the index you specify.

  • segment:

    An unsigned integer index of a segment.

  • animated:

    True if the insertion of the new segment animates; otherwise, False.

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.

If a segment exists with the action’s identifier, this method updates the existing segment is if the index is the same or removes the segment if the index is different.

See Also

Managing segments