Domanda

Ho la seguente sottoclasse NSScroller che crea una barra di scorrimento con una manopola bianca arrotondata e senza frecce / slot (sfondo):

@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

Funziona tutto bene, tranne quando c'è un notevole ritardo quando uso lo scroller. Guarda questo video:

http://twitvid.com/70E7C

Sono confuso su cosa sto facendo di sbagliato, qualche suggerimento?

È stato utile?

Soluzione

Risolto il problema, dovevo solo riempire il rettangolo in drawKnobSlotInRect:

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top