I have a very simple setup. It's a single window with a toolbar, completely filled with a NSScrollView
. The window is setup as follows:
window.styleMask = [.titled, .resizable, .closable, .fullSizeContentView]
window.titleVisibility = .hidden
This looks pretty gorgeous! However, I need to change how the content of the document view behaves as its frame changes. The problem is that docuentView.visibleRect
reports that the minY
is 0.0
until it hits the top of the window, not the bottom of the toolbar! So some of my custom drawing and behavior is cut off, and that is not so gorgeous.
How do I find the actually-usable rect of that document view, which excludes the part of it beneath the toolbar?
There is a property on the window called
contentLayoutRect
, which represents the portion of the window content that is visible (using non-flipped coordinates). You can use this to position the content view and rest assured that this will still work if Apple decides some other edge of the window becomes obscured.