title: How to customize a NSSlider
body: <p>I'm trying to implement a custom slider in Cocoa with 5 values. See my demo project, which can be downloaded here: <a href="http://s000.tinyupload.com/index.php?file_id=07311576247413689572" rel="nofollow noreferrer">http://s000.tinyupload.com/index.php?file_id=07311576247413689572</a>.</p>
  
  <p><img src="https://i.stack.imgur.com/Ir2zb.png" alt="Custom Slider"></p>
  
  <p>I've subclassed the <em>NSSliderCell</em> and implemented methods like <code>drawKnob:(NSRect)knobRect</code> and <code>drawBarInside:(NSRect)cellFrame flipped:(BOOL)flipped</code> etc.</p>
  
  <p>I'm facing some issues:</p>
  
  <ol>
  <li>I'm not able to position the knob correctly regarding to the background image. I know that I'm able to change the knob's frame, and I've tried doing some calculation to position the knob correctly, but I'm not able to make it work for my custom slider. Could someone please help me with this?</li>
  <li>The height of my custom slider background is 41px. In the <code>drawBarInside:(NSRect)cellFrame flipped:(BOOL)flipped</code> I change the height of the frame to 41px as well, but the entire background is not visible. Why?</li>
  <li>I've noticed that the included images (the background and knob) are flipped vertically. Why? Note that the border top is darker in the background compared to the bottom, but this is reversed when I draw the background.</li>
  </ol>