iOS Question [Solved] Change statusbar color in all pages

asales

Expert
Licensed User
Longtime User
I tried to use this code to change the color of statusbar, but only works in the first page:
1762784293173.png
1762784306605.png


The problem is because this line (I have my own navigation bar):
NavControl.NavigationBarVisible = False

How can I change the color of status bar in all pages, with the navigation bar = false?

Here the code:
B4X:
#PlistExtra: <key>UIViewControllerBasedStatusBarAppearance</key><false/>

Private Sub Application_Start (Nav As NavigationController)
    NavControl = Nav
    Dim PagesManager As B4XPagesManager
    PagesManager.Initialize(NavControl)
    
    NavControl.NavigationBarVisible = False  'hide navigation bar b4xpages
    
    Dim NavBarBarTintColor As Int = Colors.RGB(233,176,0)
    Dim no As NativeObject = NavControl
    no.GetField("navigationBar").RunMethod("setBarTintColor:", Array(no.ColorToUIColor(NavBarBarTintColor)))
    no.GetField("view").As(View).Color = NavBarBarTintColor
End Sub

Thanks in advance.
 
Solution
NavControl.NavigationBarVisible = False 'hide navigation bar b4xpages
I use this in all my apps, together with this Plist entry:
B4X:
#PlistExtra: <!--<key>UIUserInterfaceStyle</key>-->

Dim NavBarBarTintColor As Int = Colors.RGB(233,176,0) Dim no As NativeObject = NavControl no.GetField("navigationBar").RunMethod("setBarTintColor:", Array(no.ColorToUIColor(NavBarBarTintColor))) no.GetField("view").As(View).Color = NavBarBarTintColor
try it without this code

Alexander Stolte

Expert
Licensed User
Longtime User
NavControl.NavigationBarVisible = False 'hide navigation bar b4xpages
I use this in all my apps, together with this Plist entry:
B4X:
#PlistExtra: <!--<key>UIUserInterfaceStyle</key>-->

Dim NavBarBarTintColor As Int = Colors.RGB(233,176,0) Dim no As NativeObject = NavControl no.GetField("navigationBar").RunMethod("setBarTintColor:", Array(no.ColorToUIColor(NavBarBarTintColor))) no.GetField("view").As(View).Color = NavBarBarTintColor
try it without this code
 
Upvote 1
Solution
Top