In a Mac app, I am presenting a sheet containing an NSPredicateEditor:
parentViewController.presentAsSheet(predicateEditor)
I created a sample project for this behavior here:
https://github.com/pkamb/Feedback_NSPredicateEditor
In macOS 10.14 Mojave and 10.15 Catalina, after the introduction of Dark Mode, this results in a number of UI bugs.
The background of the NSPredicateEditor controls does not match the background of the row / superview's background. Note the is
background and the background of the text fields.
- Dark Mode:
- Light Mode:
How can these sheet-presented NSPredicateEditor UI bugs be fixed?
Bug Reports:
- rdar://42789149 - NSPredicateEditor does not behave well in dark mode in a sheet
- rdar://46142171 - NSPredicateEditor presented by a Sheet is completely broken in Dark Mode
This answer fixes the subtly wrong background colors of NSPredicate editor controls as shown here:
Insert a Visual Effects View using a flipped coordinate system into the Predicate Editor view hierarchy. The flipped VEV should exist between the NSClipView and the NSPredicateEditor.
Then add autolayout constraints as shown below. Do not constrain the bottom or height anchors of the VEV.
Note:
Setting the
scrollView.documentView = flippedVEV
fixes scrolling.If you do not use an
isFlipped
VEV, the Predicate Editor rows stack at the bottom rather than the top.