gpt4 book ai didi

objective-c - NSScroller 图形故障/滞后

转载 作者:行者123 更新时间:2023-12-03 16:39:43 31 4
gpt4 key购买 nike

我有以下 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

这一切都工作正常,除了当我使用滚动条时有明显的延迟。观看此视频:

http://twitvid.com/70E7C

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

最佳答案

解决了这个问题,只需在drawKnobSlotInRect中填充矩形即可:

关于objective-c - NSScroller 图形故障/滞后,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1604682/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com