Trouble with NSTableViews in macOS 11.x


Sak Wathanasin
 

The tableviews in one of our apps is behaving strangely when running on macOS 11.x. I have managed to reproduce thsi with a simple test app. Essentially, the issue occurs if if I build using the 11.x SDK (ie using Xcode 12.2 or later) when running on 11.x.

What happens is that the table is shifted to the right when running on 11.x. This happens with both view-based and cell-based tables. For example, the frame for the (0,0) cell is

on 10.15: (1.0, 1.0, 116.0, 24.0)
on 11.2.3: (6.0, 1.0, 116.0, 24.0)

Even weirder, if I set the enclosing NSScrollView to "no borders" the frame is now

(16.0, 1.0, 116.0, 24.0)

AND the grid lines don't extend the full width of the table, AND the line after the last row isn't drawn (that's what got QA on to the case).

On 10.15, my test tables look like this - both tables the same except for the border, and both aligned left:

But on 11.x, it looks like this:

As you can see, the "no border" version is very different.

Looking at the release notes (https://developer.apple.com/documentation/macos-release-notes/appkit-release-notes-for-macos-11), the only thing I could see that might be relevant is

NSScrollView
• When linked on macOS Big Sur 11 or later, an NSScrollViewwith automaticallyAdjustsContentInsets set to truewill continue to respect the safe-area insets of the window even when titlebarAppearsTransparent is set to true. For apps linked earlier than macOS Big Sur 11 NSScrollViewwill ignore the automatic insets when titlebarAppearsTransparent is set to true.

But my scrollviews have this turned off.

I haven't seen any reports of this issue so I assume I'm doing something very stupid. Any idea what? I can send the test project to anyone who has the time to look at it; it's tiny.

Many thanks for any help

Sak Wathanasin
Network Analysis Limited           http://www.network-analysis.ltd.uk

Join cocoa@apple-dev.groups.io to automatically receive all group messages.