Pergunta

Eu tenho a seguinte subclasse NSSCROLLER que cria uma barra de rolagem com um botão branco arredondado e sem flechas/slot (fundo):

@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

Tudo isso funciona bem, exceto que há um atraso perceptível quando eu uso o rolador. Veja este vídeo:

http://twitvid.com/70e7c

Estou confuso sobre o que estou fazendo de errado, alguma sugestão?

Foi útil?

Solução

Corrigido o problema, só tinha que preencher o Rect em DrawknoTinRect:

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top