I am creating UI elements with glass backgrounds such as:
UIVisualEffectView(effect: UIGlassEffect(style: .regular))
And UIButtons such as:
var buttonConfig = UIButton.Configuration.glass()
This gives the glass a dark background and white tint/labels when the device interface settings are dark, and conversely light backgrounds with black tint/labels when the interface mode is light. Perfect!
Now enter the UINavigationBar buttons. I've spent a day trying every configuration possible to make them match the rest of the UI. But they have a mind of their own. They will flash different colors when scrolling the content. They do not respect the user interface mode.
Out of desperation, I tried adding my own glass UIVisualEffectView behind the navigation bar and and disabled the button glass background with:
someBarItem.hidesSharedBackground = true
Even though I don't like that design as much as the individual glass buttons, it at least lets me match the rest of the UI. Alas that setting makes the animation to the next screen visually buggy. Hard to describe, but it's not acceptable.
The only thing it seems I can do is make the content view start below the navigation bar area. But then I completely lose the glass effect - though at least I can make them match the rest of the UI and the push/pop animation isn't buggy.
I realize I can opt out of glass entirely, but I want to use glass. The problem isn't glass. The problem is the navigation bar does not respect the user interface mode or allow us to set the glass type. I get the system trying to make the glass more legible, but, the buttons that I can set with UIButton.Configuration.glass() and UIGlassEffect(style: .regular) are always legible regardless of the background color because the tint/label color is the opposite of button background color.
I've been a full time iOS developer for 15 years, and this is most frustrating UIKit changes I've ever seen. It's a step backward when it's impossible to make the navigation bar match the rest of the UI. It's a step backwards when the navigation bar flickers and changes.
All that we need is a glass property for the UINavigationBarItems or UINavigationBarAppearance that works like UIGlassEffect or UIButton.Configuration glass configurations. Or default behavior that just respects traitCollection.userInterfaceStyle or overrideUserInterfaceStyle to begin with.
Dark UserInterfaceStyle example. The top buttons should match the bottom UI elements, but does not seem possible.
0
0
113