Instance Method

setTitle(_:forSegmentAt:)

Sets the title of a segment.

Declaration

func setTitle(_ title: String?, forSegmentAt segment: Int)

Parameters

title

A string to display in the segment as its title.

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; values exceeding this upper range are pinned to it.

Discussion

A segment can only have an image or a title; it can’t have both. There is no default title.

See Also

Managing Segment Content

func setImage(UIImage?, forSegmentAt: Int)

Sets the content of a segment to a given image.

func imageForSegment(at: Int) -> UIImage?

Returns the image for a specific segment

func titleForSegment(at: Int) -> String?

Returns the title of the specified segment.