Scroller background not transparent in NSScrollView

Override NSScroller and do the following. This will give you a transparent background.

- (void) drawRect: (NSRect) dirtyRect
{
    [self drawKnob];
}

My only suggestion is to make sure that your NSScrollers are of the default style, or set to a class that overrides + (BOOL)isCompatibleWithOverlayScrollers if you are using a custom scroller.

In IB, check that "Default Style" is selected under "Scroller Knobs", second from the top.

enter image description here


OS X Lion introduced the new NSScrollers (overlay scrollers) in contrast to the versions present in Snow Leopard and before SL (legacy scrollers). The overlay scrollers are the type that fade in/out, and draw on top of the content without the glaring white background.

In some scenarios Lion decides to use the legacy scroller instead of the new overlay scrollers (because, e.g., if a pointer device w/o scroll wheel is plugged in, it can't exactly scroll a hidden overlay scroller)

The OS X 10.7 documentation explains it well. To summarize, check if a) the user disabled overlay scrollers, b) if you have an unsupported device plugged in, or c) you're subclassing NSScroller, adding accessory views, or forgetting to override + (BOOL)isCompatibleWithOverlayScrollers.

If you dislike the legacy scrollers showing up and want to support non-supported devices (e.g. a gray scrollbar drawn on top of content that doesn't fade in/out) you must subclass NSScroller and draw it custom-ly. Applications like Twitter for Mac do this.