iOS Question TabBar Item Color of non active item


Licensed User
Dim no As NativeObject = tbc
    no.GetField("tabBar").SetField("tintColor", no.ColorToUIColor(Colors.white)) 'active item
    no.GetField("tabBar").SetField("barTintColor", no.ColorToUIColor(limablue)) 'bar color
    no.GetField("tabBar").SetField ("translucent",   False)

Hi, with this code i can set the bar color and the color of the active item.
How can i set the color of the non active item ? in my case it is grey and almost invisible...


B4X founder
Staff member
Licensed User
Longtime User
1. Not relevant to this question but I already made an answer and it can be useful in other cases:

Change BarButton colors:
Sub SetBarButtonColor(bb As BarButton, ActiveColor As Int, DisabledColor As Int)
    Dim attributes As NativeObject
    attributes = attributes.Initialize("B4IAttributedString").RunMethod("createAttributes::", _
     Array(Font.CreateNew(18), attributes.ColorToUIColor(ActiveColor)))
    Dim no As NativeObject = bb
    no.RunMethod("setTitleTextAttributes:forState:", Array(attributes, 0))
    attributes = attributes.Initialize("B4IAttributedString").RunMethod("createAttributes::", _
     Array(Font.CreateNew(18), attributes.ColorToUIColor(DisabledColor)))
    no.RunMethod("setTitleTextAttributes:forState:", Array(attributes, 2))
End Sub

'for example, to change the colors of all the tool bar buttons:
For Each bb As BarButton In Page1.ToolbarButtons
    SetBarButtonColor(bb, xui.Color_Red, xui.Color_Blue)

2. Set the color of unselected tab bar items:
Dim no As NativeObject = tbc
no.GetField("tabBar").SetField("unselectedItemTintColor", no.ColorToUIColor(Colors.Red))
Available from iOS 10.
Upvote 0