I kind of performed the implementation of a custom slider cell that can draw using images for the scroll bar and pen. The only obstacle that is now on the way is when I quickly drag the handle, the images are messed up. I posted a screenshot.

Here is the code:
#import "customSliderCell.h" @implementation customSliderCell - (void)drawKnob:(NSRect)knobRect { NSImage * knob = knobImage; [[self controlView] lockFocus]; [knob compositeToPoint:NSMakePoint(knobRect.origin.x,knobRect.origin.y+knobRect.size.height) operation:NSCompositeSourceOver]; [[self controlView] unlockFocus]; } - (void)drawBarInside:(NSRect)rect flipped:(BOOL)flipped { rect.size.height = 8; NSRect leftRect = rect; leftRect.origin.x=0; leftRect.origin.y=2; leftRect.size.width = knobrect.origin.x + (knobrect.size.width); [leftBarImage setSize:leftRect.size]; [leftBarImage drawInRect:leftRect fromRect: NSZeroRect operation: NSCompositeSourceOver fraction:1]; NSRect rightRect = rect; rightRect.origin.x=0; rightRect.origin.y=2; rightRect.origin.x = knobrect.origin.x; [rightBarImage setSize:rightRect.size]; [rightBarImage drawInRect:rightRect fromRect: NSZeroRect operation: NSCompositeSourceOver fraction:1]; }
Ah, I'm so close. any help regarding why this is happening and how to solve it will be greatly appreciated, thanks!
objective-c cocoa nsslider
han
source share