iOS Question TabBar Item Color of non active item

MList

Active Member
Licensed User
B4X:
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...
 

Erel

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:
B4X:
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)
Next


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