iOS Question toolBar color error

HuZz

Member
Licensed User
Hi,
i'm trying to set the toolBar color with the snippets found here in the forum, as
B4X:
Dim no As NativeObject    
    no = NavControl
    no.GetField("toolBar").SetField("barTintColor", no.ColorToUIColor(Colors.Black))

but i always receive back an error like this:

B4X:
[<B4INavigationController 0x10880f000> valueForUndefinedKey:]: this class is not key value coding-compliant for the key toolBar.

What am i doing wrong?

And related to the toolbar... is it not possible to use fontAwesome o MaterialIcons icon as button i the bar?

thanks
 

Erel

Administrator
Staff member
Licensed User
I see. This code no longer works. Apple has removed the access to the internal toolbar.

You can use this sub instead:
B4X:
Private Sub ChangeToolbarTintColor(clr As Int)
   Dim no As NativeObject
   no.Initialize("UIToolbar").RunMethod("appearance", Null) _
     .RunMethod("setTintColor:", Array(no.ColorToUIColor(clr)))
End Sub

Make sure to call it before you load the layout.
 
Last edited:
Upvote 0
Top