I've searched around for some code on NSSliderCell
but I can't find a way to do what I'm looking for.
I'd like to create something like this (where the white line is the slider knob, 1 pixel width):
I'm going to use this for the time bar of a music track, so it's going to move every second (that's why I want to use a NSSlider
to make things easy).
What do I need to do to make a slider, with a transparent middle bar, similar to the image above?
PS: It's not going to be touchable, it's just for display.
I finally got it:
NSSliderCell
subclass with a property@property float x
;drawKnob
method and inside it I wrote:NSSlider
into my window (made it small, changed it's width to the window's width) and changed it's cell class to the one I created;_timerBarSlider
is the NSSlider I have in IB /_timerBarImageView
is the image view that contains the vertical image line /_timerBarSlderCell
is the NSSlider's cell (subclassed)PS: the NSSlider is behind every object in that window, so that the user can't see it. You can't
setHidden:YES
on it because thedrawKnob
method will not be called.