1

At certain points in my app's lifetime I want to slot in a temporary 'overlay view' that sits on top of all of the content contained with the window's contentView. I add this view as the last subview of the contentView and give it a partially transparent red color. The problem is, for reasons I don't understand, the scroll views within the view hierarchy don't appear to be covered by this overlay.

In this screenshot everything (aside from the window decorators) should be covered by the red overlay view, but the scroll views clearly aren't:

enter image description here

What's going on? What is it about Cocoa's drawing routines that means scroll views don't behave like other views in this situation, and what can I do about it?

Paul Patterson
  • 6,840
  • 3
  • 42
  • 56
  • It might be related to the view z-order. Check this SO question: http://stackoverflow.com/questions/14750393/sibling-nsview-z-ordering-in-cocoa, maybe you'll find something useful. – Cristik Apr 21 '15 at 22:05
  • 3
    It may have something to do with Core Animation layers, in which case it may help to make your overlay be layer-backed. If you can't fix it that way, consider making your overlay a child window. – JWWalker Apr 21 '15 at 22:28
  • 1
    A lot of things have been changed with regard to scroll views for several reasons (including visual effect views and scroll view's new floating view support). If you can verify the above suggestions don't help, file a bug report with Apple. JWWalker's child window approach is probably the best for a block-out overlay, however. – Joshua Nozzi Apr 22 '15 at 15:47
  • Sorry, I should have responded sooner. JWWalker's suggestion works well, so if you're out JW and you submits it as answer you'll get the points. Part of the reason for my not getting back straight-away was the hope that someone might be able to *explain* the issue as well as solve it. The window approach had occurred to me, but I wanted to stick with views; it's probably rubbish, but windows somehow *feel* heavier and more cumbersome. – Paul Patterson Apr 22 '15 at 17:26

0 Answers0