SegmentedControl

A subclass of Control which wraps NSSegmentedControl.

class SegmentedControl(parent)
Parameters:parent – A View instance. See View.parent.
segmentStyle

Cocoa constant. Equivalent to [self segmentStyle] and sets the look of the control. Use with NSSegmentStyle constants.

trackingMode

Cocoa constant. Equivalent to [[self cell] trackingMode] and determines whether one, any or no segment can be selected at once. Use with NSSegmentSwitchTracking constants.

addSegment(label, width)
Parameters:
  • label – String
  • width – Numeric

Adds a new segment with the specified label and width and returns it. The width of the segmented control will be automatically adjusted to the sum of allsegment widths plus an overhead (8).

Segment

Represent a segment in a SegmentedControl. It doesn’t wrap any Cocoa class because none exist for that, but it still determines how segments in the parent segmented control are going to be set up. Instantiate with SegmentedControl.addSegment()

class Segment
label

String. The label of the segment.

width

Numeric. The width of the segment.

image

String. Name of the image resource to display in the segment.

accessibilityDescription

String. The string that is spoken out by Voice Over when the segment is selected. There’s no equivalent for this feature in XCode. To set a segment’s accessibility description in a normal project, you have to resort to manual code. Well, not with xibless!

Table Of Contents

Previous topic

SplitView

Next topic

Slider

This Page