Search code examples
cocoansslider

Is it possible to label the tick marks on an NSSlider


I have some vertical sliders and I want to be able to label the tick marks with the values they represent. Is there a better way to do this besides manually putting labels next to them in the Interface Builder? If not, is there a way to at least make those labels line up right with the tick marks or do I have to do it freehand?


Solution

  • I don't see any builtin capability to label tickmarks. However, see NSSliderCell, which has a method called -rectOfTickMarkAtIndex:: Apple's NSSliderCell documentation

    This appears to be the way to ensure your labels are correctly aligned with the tick marks.