The app we're writing a.t.m. contains both dark and light pages. We rely mainly on stack navigation and so a
NavigationPage is in use. Most pages should display the Navigation Bar but there are exceptions.
Now, I have not managed to crack how to ensure a proper Status Bar behavior. I have tried to rely on the default behavior (setting the info.plist
UIViewControllerBasedStatusBarAppearance = false) but that produces som weird behavior related to modal pages and landsape mode.
When I push a modal page the status bar appearance isn't affected (if already white text it remains white on a white modal page background, or the other way around).
This behavior goes away if I set the
UIViewControllerBasedStatusBarAppearance = true to take control of the status bar. I don't even have to override the
PreferredStatusBarStyle method in a custom
Is the behavior I'm seeing (with a non-adjusting statusbar on modal pages) a bug in iOS or in Xamarin Forms?
When writing a custom renderer (based on this code) I can achieve a transparent (Apple "translucent") navigation bar which then automatically yields a status bar with the correct style (light when background is dark or the other way around). The problem is I can't figure out how to set a "normal" navigation bar for individual pages; once I've made the nav-bar transparent I can't make it opaque (or "translucent").
I run this code in the custom renderer's overridden
ViewDidLoad to produce the transparent navigation bar ...
UINavigationBar.Appearance.SetBackgroundImage(new UIImage(), UIBarMetrics.Default); UINavigationBar.Appearance.ShadowImage = new UIImage(); UINavigationBar.Appearance.BackgroundColor = UIColor.Clear; UINavigationBar.Appearance.TintColor = getTextColor().ToUIColor(); UINavigationBar.Appearance.BarTintColor = UIColor.Clear; UINavigationBar.Appearance.Translucent = true; UINavigationBar.Appearance.BarStyle = UIBarStyle.Black;
... which does the trick. But running the same code again with different values (when pushing new pages) have no effect.
Is it not possible to affect the navigation bar appearance dynamically? If it is; what am I doing wrong?