开发者

NSView background image composed of 3 different files

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.

NSView background image composed of 3 different files

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);
}


If you want to redraw the whole view, you should be using [self bounds], not the rect passed into your -drawRect: method.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜