iOS Question Background color top bar

angel_

Well-Known Member
Licensed User
Longtime User
How can I change the background color of the top bar (I use B4XPages+B4XDrawer), in iOS 14.5 it is gray and in iOS 15.4 it is white in Phone 12 Pro Max with the simulator appetize.io.

iOS 14.5:

Captura_iOS_14.5.JPG


iOS 15.4:
Captura_iOS_15.4.JPG
 
Solution
This code is from the Pleroma client example:
B4X:
'Application_Start - Main module
Dim no As NativeObject = NavControl
    no.GetField("navigationBar").RunMethod("setBarTintColor:", Array(no.ColorToUIColor(NavBarBarTintColor)))
    no.GetField("view").As(View).Color = NavBarBarTintColor
    Dim no As NativeObject = App
    no.RunMethod("setStatusBarStyle:", Array(1))
    SetTitleColor(Nav, Colors.White)
    Dim no As NativeObject = NavControl
    no.GetField("navigationBar").RunMethod("setTintColor:", Array(no.ColorToUIColor(NavBarTintColor)))

Sub SetTitleColor(nav As NavigationController, clr As Int)
    Dim attributes As NativeObject
    attributes = attributes.Initialize("B4IAttributedString").RunMethod("createAttributes::", _...

Erel

B4X founder
Staff member
Licensed User
Longtime User
This code is from the Pleroma client example:
B4X:
'Application_Start - Main module
Dim no As NativeObject = NavControl
    no.GetField("navigationBar").RunMethod("setBarTintColor:", Array(no.ColorToUIColor(NavBarBarTintColor)))
    no.GetField("view").As(View).Color = NavBarBarTintColor
    Dim no As NativeObject = App
    no.RunMethod("setStatusBarStyle:", Array(1))
    SetTitleColor(Nav, Colors.White)
    Dim no As NativeObject = NavControl
    no.GetField("navigationBar").RunMethod("setTintColor:", Array(no.ColorToUIColor(NavBarTintColor)))

Sub SetTitleColor(nav As NavigationController, clr As Int)
    Dim attributes As NativeObject
    attributes = attributes.Initialize("B4IAttributedString").RunMethod("createAttributes::", _
     Array(Font.CreateNew(18), attributes.ColorToUIColor(clr)))
    Dim no As NativeObject = nav
    no.GetField("navigationBar").RunMethod("setTitleTextAttributes:", Array(attributes))
End Sub
 
Upvote 1
Solution
Top