NSScrollView Overlay Mavericks

since Mavericks I have the following problem in my app: I programmatically create a NSBox with the size of the window. Then I add it as a subview to the windows contentView. So I want to overlay all interface elements on the view. This worked perfectly since Mountain Lion, in Mavericks the NSScrollView will not get overlayed.

Maybe you can see it in a similar example from apple. https://developer.apple.com/library/mac/samplecode/OverlayView/Introduction/Intro.html

Any hints for a workaround? This seems to be a bug, but I have no Apple Dev Account to file a bug.


I think a better solution would be to implement

- (BOOL)wantsLayer

and return NO.

Apple has apparently changed NSScrollView in 10.9 so it draws in layers -- for special scrolling effects, or speed, or maybe just to give us something to do, because we're all so under-worked. This affects NSTextViews, NSTableViews, and PDFViews among others. I have seen lots of cases (for example, my app's main document view) where this is fine, but in several circumstances it messes up horribly. Two examples: a resizing Preferences panel that animates fade in/fade out when you change panes, and a detail view with sections that can collapse. In the latter case, if you click on a table view in 10.9 the table view VANISHES, then if you open a collapsed section it reappears UPSIDE DOWN.

By refusing to use layers as mentioned above, you're declining to participate in this madness and forcing the scroll view to draw the old way.

afaik, overlaying sibling views is supported only for layer backed views. Non layer backed views which overlay each other are not recommended. For some osx version, such situations were not guaranteed to draw properly. Your best long term solution here is to make your overlay view, a layer backed view

Haha, found the solution by coincidence (I still even don't know, why it's working ^^). I created a subclass of NSScrollView and added this:

- (void)drawLayer:(CALayer *)layer inContext:(CGContextRef)ctx {

Need Your Help

Reverse a string through string class itself


I have a string let's say "saral". I want to reverse this string.

How can I convert a number to its multiple form in Perl?

perl format numbers

Do you know an easy and straight-forward method/sub/module which allows me to convert a number (say 1234567.89) to an easily readable form - something like 1.23M?