Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I recommend subclassing the NSScroller and override <code>– drawArrow:highlight:</code> / <code>– drawKnobSlotInRect:highlight:</code> / <code>– drawKnob</code> methods so you have a stable scroller appearance.</p> <p>P.S. Don't forget to set your new scroller class in XIB-file for the scrollers.</p> <p><strong>UPDATE</strong></p> <p>Here is the sample code:</p> <pre><code>- (void)drawKnob { // call the default implementation for Overlay Scrollers if (self.scrollerStyle == NSScrollerStyleOverlay) { [super drawKnob]; return; } if (_style == NSScrollerKnobStyleLight || _style == NSScrollerKnobStyleDefault) [[NSColor colorWithCalibratedWhite:1.0 alpha:0.8] setFill]; else [[NSColor colorWithCalibratedWhite:0 alpha:0.4] setFill]; // Note: you can specify the rect with fixed width here NSRect knobRect = [self rectForPart:NSScrollerKnob]; // VERTICAL SCROLLER NSInteger fullWidth = knobRect.size.width; knobRect.size.width = round(knobRect.size.width/2); knobRect.origin.x += (NSInteger)((fullWidth - knobRect.size.width)/2); // draw... NSBezierPath * thePath = [NSBezierPath bezierPath]; [thePath appendBezierPathWithRoundedRect:knobRect xRadius:4 yRadius:4]; [thePath fill]; } //--------------------------------------------------------------- - (void)drawKnobSlotInRect:(NSRect)slotRect highlight:(BOOL)flag { // call the default implementation for Overlay Scrollers // draw nothing for usual if (self.scrollerStyle == NSScrollerStyleOverlay) { [super drawKnobSlotInRect:slotRect highlight:flag]; } } //--------------------------------------------------------------- - (void)drawArrow:(NSScrollerArrow)whichArrow highlight:(BOOL)flag { // call the default implementation for Overlay Scrollers // draw nothing for usual if (self.scrollerStyle == NSScrollerStyleOverlay) { [super drawArrow:whichArrow highlight:flag]; } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload