I'm trying to set a background image of an NSView. (Actually an NSScrollView.) At the moment I'm subclassing drawRect: and I'm using NSDrawThreePartImage
to draw the image but there are a few things that are not correct whenever I start scrolling.
Are there better ways to draw the images?
- (void)drawRect: (NSRect)dirtyRect
{
dirtyRect.size.height -= 18; //Moving the image up a bit for future subclassing of NSScroller.
NSDrawThreePartImage(dirtyRect, viewLeftCap, viewFill, viewRightCap, NO, NSCompositeSourceOver, 1, YES);
}
NSDrawThreePartImage
is usually the preferred way of doing this. You should probably post yourdrawRect:
implementation. – kperryua