macoscocoanssegmentedcontrol

Cannot add more elements to NSSegmentedControl


I have this NSSegmentedControl created on interface builder and saved on a xib file. The control has initially 4 segments.

If I use this

[self.myControl setSegmentCount:6];

to increase the number of segments to 6, programmatically, it will not work but if I do

[self.myControl setSegmentCount:2];

to reduce the number of segments to 2, it works.

if after that I return the number of segments to 4, it works, but I cannot pass the number of segments defined on interface builder.

Any clues?


Solution

  • Select a segment in interface builder and click on the little ruler in the right hand sidebar to add layout constraints and prevent clipping