开发者

NSScroller graphical glitches/lag

I have the following NSScroller subclass that creates a scroll bar with a rounded white knob and no arrows/slot (background):

@implementation IGScr开发者_StackOverflow社区ollerVertical

- (void)drawKnob
{
    NSRect knobRect = [self rectForPart:NSScrollerKnob];
    NSRect newRect = NSMakeRect(knobRect.origin.x, knobRect.origin.y, knobRect.size.width - 4, knobRect.size.height);
    NSBezierPath *path = [NSBezierPath bezierPathWithRoundedRect:newRect xRadius:7 yRadius:7];
    [[NSColor whiteColor] set];
    [path fill];
}

- (void)drawArrow:(NSScrollerArrow)arrow highlightPart:(int)flag
{
    // We don't want arrows
}

- (void)drawKnobSlotInRect:(NSRect)rect highlight:(BOOL)highlight
{
    // Don't want a knob background
}
@end

This all works fine, except there is a noticable lag when I use the scroller. See this video:

http://twitvid.com/70E7C

I'm confused as to what I'm doing wrong, any suggestions?


Fixed the issue, just had to fill the rect in drawKnobSlotInRect:

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜