2009-10-22 66 views
2

我有以下NSScroller子类,创建具有圆形白色旋钮滚动条和没有箭头/槽(背景):NSScroller故障的图形/滞后

@implementation IGScrollerVertical 

- (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 

这一切都工作正常,但有一个noticable当我使用滚轮时会滞后。看到这段视频:

http://twitvid.com/70E7C

我很困惑,我在做什么错了,有什么建议?

回答

2

修正了这个问题,只好在drawKnobSlotInRect中填写矩形: