HuZz Member Licensed User Oct 27, 2017 #1 Hi, i'm trying to set the toolBar color with the snippets found here in the forum, as Code: Copy Dim no As NativeObject no = NavControl no.GetField("toolBar").SetField("barTintColor", no.ColorToUIColor(Colors.Black)) but i always receive back an error like this: Code: Copy [<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
Hi, i'm trying to set the toolBar color with the snippets found here in the forum, as Code: Copy Dim no As NativeObject no = NavControl no.GetField("toolBar").SetField("barTintColor", no.ColorToUIColor(Colors.Black)) but i always receive back an error like this: Code: Copy [<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 B4X founder Staff member Licensed User Longtime User Oct 29, 2017 #2 Where does this code come from? About the icons: https://www.b4x.com/android/forum/threads/barbutton-icons.74192/#content Upvote 0
Where does this code come from? About the icons: https://www.b4x.com/android/forum/threads/barbutton-icons.74192/#content
HuZz Member Licensed User Oct 30, 2017 #3 Erel said: Where does this code come from? Click to expand... Which code? the one i use trying to get the toolbar coloured or the error code? The error is referred to no.GetField("toolBar") And the code used is taken from a post you answered to, here: https://www.b4x.com/android/forum/threads/toolbar-color.71898/#post-457335 Upvote 0
Erel said: Where does this code come from? Click to expand... Which code? the one i use trying to get the toolbar coloured or the error code? The error is referred to no.GetField("toolBar") And the code used is taken from a post you answered to, here: https://www.b4x.com/android/forum/threads/toolbar-color.71898/#post-457335
Erel B4X founder Staff member Licensed User Longtime User Oct 30, 2017 #4 I see. This code no longer works. Apple has removed the access to the internal toolbar. You can use this sub instead: Code: Copy 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: Oct 30, 2017 Upvote 0
I see. This code no longer works. Apple has removed the access to the internal toolbar. You can use this sub instead: Code: Copy 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.
HuZz Member Licensed User Oct 30, 2017 #5 Thank Erel, but it doesn't work for me... i followed your instraction and called the sub before loading the layout, but i continue to see the white toolbar... Upvote 0
Thank Erel, but it doesn't work for me... i followed your instraction and called the sub before loading the layout, but i continue to see the white toolbar...
Erel B4X founder Staff member Licensed User Longtime User Oct 30, 2017 #6 It doesn't change the bar color. Only the color of the toolbar items. Upvote 0
HuZz Member Licensed User Oct 30, 2017 #7 Erel said: It doesn't change the bar color. Only the color of the toolbar items. Click to expand... so it is not possible to change the tool bar background color????? Upvote 0
Erel said: It doesn't change the bar color. Only the color of the toolbar items. Click to expand... so it is not possible to change the tool bar background color?????
Erel B4X founder Staff member Licensed User Longtime User Oct 30, 2017 #8 You haven't copied the code correctly. It still works: https://www.b4x.com/android/forum/threads/toolbar-color.71898/#post-457275 It should be toolbar instead of toolBar. Upvote 0
You haven't copied the code correctly. It still works: https://www.b4x.com/android/forum/threads/toolbar-color.71898/#post-457275 It should be toolbar instead of toolBar.
HuZz Member Licensed User Oct 30, 2017 #9 you were right! sorry my mistake... it works! thanks Upvote 0