How to change height of NSSegmentedControl

1.4k Views Asked by At

I'm trying to increase the height of a NSSegmentedControl, beyond the 25px "Regular" control size. I subclassed NSSegmentedCell, I understand that i have 2 methods to work with.

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

- (void)drawWithFrame:(NSRect)frame
               inView:(NSView *)view

If I place a segmented control in IB then override the above methods in my NSSegmentedCell subclass. As excepted the frame and view that are passed in are based on the height of the segmented control in IB. So, Im not sure where to go from here.

Do I have to subclass NSSegmentedControl as well and draw my own control at my required height? and then use the NSSegmentedCell subclass to handle the segments?

1

There are 1 best solutions below

1
On

The 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.