Contents

widthForSegment(at:)

Returns the width of the segment at the index you specify.

Declaration

func widthForSegment(at segment: Int) -> CGFloat

Parameters

  • segment:

    An index number identifying a segment in the control. It must be a number between 0 and the number of segments (Numberofsegments) minus 1; the segmented control pins values exceeding this upper range to the last segment.

Return Value

A float value specifying the width of the segment. If the value is {0.0}, UISegmentedControl automatically sizes the segment.

See Also

Managing segment behavior and appearance