How to change the height of an NSSegmentedControl

I am trying to increase the height of an NSSegmentedControl beyond the 25px "Regular" size control. I have subclassed NSSegmentedCell, I understand that I have 2 methods for working.

- (void)drawSegment:(NSInteger)segment inFrame:(NSRect)frame withView:(NSView *)controlView - (void)drawWithFrame:(NSRect)frame inView:(NSView *)view 

If I put a segmented control in IB, override the above methods in my subclass of NSSegmentedCell. Because the freed frame and presentation that are transmitted are based on the height of the segmental control in IB. So I'm not sure where to go from here.

Do I also need to subclass NSSegmentedControl and draw my own control at my desired height? and then use a subclass of NSSegmentedCell to handle segments?

+5
source share
1 answer

By default, NSSegmentedControl does not allow you to adjust its drawn height. To do this, you will have to subclass it (and NSSegmentedCell ) and override its drawing functions with your own.

0
source

Source: https://habr.com/ru/post/1200235/


All Articles