NSScrollView's custom content inset
NSScrollView's custom content inset
- Subject: NSScrollView's custom content inset
- From: Dragan Milić via Cocoa-dev <email@hidden>
- Date: Thu, 5 Nov 2020 20:49:48 +0100
… trying again, as the stupid DTK machine suddenly reseted itself (it does that
regularly) and incomplete message was somehow sent on booting back!!
What would be the best approach to set custom insets of the contentView
(NSClipView) of a NSScrollView? I’ll try to describe the problem in more
details…
I’m trying to make and application look nice on upcoming Big Sur. The fact that
Apple has made it so hard for an application (with reasonably complicated UI)
to look good on both Bit Sur and older OS version is a topic for some other
rant thread… Anyway, I’m trying to get rid of some unwanted
NSTableView/NSOutlineView properties, introduced in Bit Sur.
I’ve got a NSOutlineView with a single column. Cells (NSView based) in that
single column show some custom content, mostly custom view full of custom Core
Text drawing and colouring. It’s very important (visually appealing) if that
custom content is stretched through the whole width of the table, practically
to the edge of the window. This is how it should like (and does on Catalina and
earlier)…
https://zigz.ag/temp/10_15.png
Big Sur introduces a lot of new NSTableView’s properties (which, in my opinion,
just waste screen space), more about it here:
https://developer.apple.com/design/human-interface-guidelines/macos/overview/whats-new-in-macos
Besides increased default intercell spacing, inset and so on, there’s 6px (not
customisable) padding at leading and trailing row edges. So even setting
tableView style to NSTableViewStyleFullWidth, paddings remain. The final result
of how the same portion of application's window looks on Big Sur is…
https://zigz.ag/temp/11_0.png
I want to avoid that padding on both sides and I don’t see any other way than
to inset enclosing scrollView’s content view by 6px on left and right edges.
automaticallyAdjustsContentInsets and contentInsets properties serve completely
different purpose and besides, the docs say "The contentView is placed
underneath these sibling views (scrollers, rulers…) and is only inset by the
scroll view border and non-overlay scrollers”. So those properties don’t affect
contentView (NSClipView) at all.
So the question is, is there some reasonably easy and sensible way of doing the
above? I want to mention in similar situations before I used to “hijack” the
enclosing scrollView, put the outlineView (possibly with other views I needed)
in a new custom view and then make that custom view a documentView of the
scrollView. Unfortunately that approach seems invalid on Big Sur, as the
outliveView seems to have gotten much more “under the hood” interactions with
the enclosing clipView and scrollView and if I try that approach, outliveView’s
frame and height get completely broken. The behaviour is especially weird if
floating group rows are present. I tried this with both constraints and sprints
& struts, and neither approach worked.
Thanks in advance,
-- Dragan
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden