NSScrollView.horizontalRulerView changes ruler client frame size

In macOS 10.13, submitting an NSRuler to NSScrollView.horizontalRulerView changes the the frame of the ruler.clientView by decreasing the height (for a horizontal ruler) of the clientView frame by the thickness of the ruler. This all makes sense and seems to be a good thing.


In macOS 10.14 (Mojave) it seems this no longer happens and the client frame retains its original size. Is this a bug?


I can work around the difference with #available but somehow that doesn't seem like the right way to be doing it.

Replies

I noticed this too and kept filing bug reports during the Mojave beta but got no response from Apple.


I created a simple application with a custom view inside a scrollView to demonstrate the problem for my bug reports. On Mojave, once you make the ruler views visible, you can see that the ruler views overlay the documentView instead of the old behavior pro-Mojave which was for the documentView to appear offset from the rulers. The overlay seems intentional on Mojave rather than a bug. That's fine but we need guidance from Apple as to what we're supposed to do if we want the old behavior back which is to not overlay the documentView with the ruler views.


What I did was:


scrollView.contentView.automaticallyAdjustsContentInsets = NO;

scrollView.contentView.contentInsets = NSEdgeInsetsZero;


and then move the contentView within the scroll view:


NSRect frame = scrollView.contentView.frame;

frame.origin.x = scrollView.rulersVisible ? scrollView.verticalRulerView.requiredThickness : 0.;

scrollView.contentView.frame = frame;


However, this has no effect during initialization of my app. I have to manually get my app to move the contentView after the app has started for the rulers not to obscure the documentView.