Reputation: 4699
I have a small app that contains an NSSplitViewController with 3 vertical split views (sidebar, content view, details view) kind of like the Mail app. I have programmatically changed the color of the divider between the different split views and that worked fine until macOS 11.
Unfortunately since upgrading the project to support macOS 11 the divider between the sidebar and the content view is back to the default apple color both in light and dark theme, and my override does not seem to work any longer.
I am currently simply subclassing NSSplitView and overriding dividerColor method as described by the Apple documentation
// ... You can override this method to change the color of dividers.
@available(macOS 10.5, *)
@NSCopying open var dividerColor: NSColor { get }
The other divider looks perfectly fine as is working as expected.
Any clues on how to override the color of the sidebar divider??
Thanks in advance for any suggestions.
Upvotes: 2
Views: 213
Reputation: 9131
Setting the dividerColor
does only work for the sidebar if you change the NSSplitViewItem.Behavior
of the first panel to default.
If you like to continue to use the sidebar behavior, it is better not to set or override the dividerColor
, because doing that removes the vibrant color treatment of sidebar divider, even if it ignores the dividerColor
setting. Which is perhaps one of the many small AppKit bugs.
Upvotes: 0
Reputation: 2423
You could try to use this method to draw the divider by yourself :
func drawDivider(in rect: NSRect)
It's even possible to call super from this method if for some reason you need the original design at times.
Upvotes: 0