Hiding NSSlider's tick marks

1.5k Views Asked by At

Is there a way to hide the tick marks of NSSlider?

3

There are 3 best solutions below

2
On

You can use the -[NSSlider setNumberOfTickMarks:] method to set the number of tick marks to zero. This will hide them.

In Interface Builder you can just set this to zero in the inspector panel.

1
On

You can override [NSSliderCell drawTickMarks] and do nothing in your implementation.

Make sure to set your subclass as the NSSlider's cell.

1
On

If you want to keep the tickmark stopping behaviour but hide them, you can override the NSSliderCell's -(NSRect)rectOfTickMarkAtIndex:(NSInteger)index and provide a rectangle with 0 dimensions.