I found an error in calculating the x position of the handle rectangle: you used the height of the image in which you had to use the width.
The cell picture is snapped to the frame of the control. Perhaps you can expand the control frame when your cell awakens.
You need to use the NSImage drawInRect:fromRect:operation:fraction:respectFlipped:hints: and pass YES for the respectFlipped: parameter. Apple usually uses inverted coordinates.
Added: The frame extension in awakeFromNib does not work, the frame is returned. Something is working here. Instead of overriding drawBarInside:flipped: add this overriding:
- (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView { NSRect controlFrame = [controlView frame]; float bgHeight = self.backgroundImage.size.height; if (controlFrame.size.height < bgHeight) { controlFrame.size.height = bgHeight; [controlView setFrame: controlFrame]; } [self.backgroundImage drawInRect: [controlView bounds] fromRect: NSZeroRect operation: NSCompositeSourceOver fraction: 1.0 respectFlipped: YES hints: NULL]; [self drawKnob]; }
Jwalker
source share