进程:

    • 选项 对象
      • mode String (optional) - The selection mode of the control:
        • single - Default. One item selected at a time, selecting one deselects the previously selected item. Maps to NSSegmentSwitchTrackingSelectOne.
        • multiple - 可以选多个项。 Maps to NSSegmentSwitchTrackingSelectAny.
        • buttons - 将段作为按钮使用, 每一段都可以被按下和释放但是不会被标记为激活状态 Maps to NSSegmentSwitchTrackingMomentary.
      • segments SegmentedControlSegment[] - 被放到控件中的段的集合
      • selectedIndex Integer (optional) - 当前选中的段的下标, 这个值会在用户交互时自动更改 When the mode is it will be the last selected item.
      • change Function (optional) - Called when the user selects a new segment.
        • isSelected Boolean - 当前段的选中状态

    实例属性

    touchBarSegmentedControl.segmentStyle

    A String representing the controls current segment style. Updating this value immediately updates the control in the touch bar.

    touchBarSegmentedControl.segments

    touchBarSegmentedControl.selectedIndex

    Integer类型表示的当前选中段 改变这个值会立即触发更新当前段 用户对触摸条的操作会自动更新这个值

    touchBarSegmentedControl.mode