Hello,
I need to set white font of iOS top status bar on some pages - programatically.
I also need to have set UIViewControllerBasedStatusBarAppearance to YES in Info.plist, because I need to hide status bar on some pages.
I tried create custom render on my MasterDetailPage and here override PreferredStatusBarStyle, but it is not working...
Function PreferredStatusBarStyle is never called...
I also tried this.NavigationController.NavigationBar.BarStyle = UIBarStyle.Black;
But it is not working NavigationController is always null.
Is there a way how to change color of StatusBar programatically when using Xamarin.Form?
Posts
Hi,
Not sure if I understand your problem correctly. Our app has some dark and some light pages, which means we want a white status bar on a dark page. We created a custom
ContentPage
for this calledContentPageEx
which has a propertyStatusBarStyle
, this can either be Light or Dark and is set in the XAML Page. In the Renderer we just useViewWillAppear
override to set the status bar like this:in the
info.plist
, i have set:hope this helps
@veryhumble Thanks, problem is, that your solution works only when UIViewControllerBasedStatusBarAppearance is set to false.
I need UIViewControllerBasedStatusBarAppearance = true, because some viewControllers of 3rd party components, that I use in project, also changing visibility of StatusBar and it only works with enabled UIViewControllerBasedStatusBarAppearance.