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