NSSegmentedControl Colors

后端 未结 1 653
别跟我提以往
别跟我提以往 2021-01-12 02:38

I\'d like to have a subclass of NSSegmentedControl where the various segments are different colors. I\'ve tried subclassing NSSegmentedControl and adding the following code:

相关标签:
1条回答
  • 2021-01-12 02:56

    You need to specify fixed width for segments.

    enter image description here

    Then your code will work pretty good (Screenshot is from my test project)

    enter image description here

    And don't forget to disable tint

     [self.segment.cell setControlTint:NSClearControlTint ];
    
    0 讨论(0)
提交回复
热议问题