iOS Question Change color of tabbar and navigationbar...

Luiz Fernando Orlandini

Active Member
Licensed User
You can change the color of the navigation bar with this code:
B4X:
Dim no As NativeObject = NavControl
no.GetField("navigationBar").RunMethod("setBarTintColor:", Array(no.ColorToUIColor(Colors.Magenta)))
I tried the suggested code, but in runtime I got and exception

B4X:
Error occurred on line: 18 (recoverpasswordmodule)
Cannot parse: (null)
Stack Trace: (
  CoreFoundation       <redacted> + 150
  libobjc.A.dylib      objc_exception_throw + 38
  CoreFoundation       <redacted> + 0
  Scholastic App       -[B4I ObjectToNumber:] + 556
  Scholastic App       -[b4i_recoverpasswordmodule _show] + 1776
  Scholastic App       -[b4i_loginmodule _btnforgotpassword_click] + 220
  CoreFoundation       <redacted> + 68
  CoreFoundation       <redacted> + 300
  Scholastic App       +[B4I runDynamicMethod:method:throwErrorIfMissing:args:] + 1928
  Scholastic App       -[B4IShell runMethod:] + 496
Scholastic App       -[B4IShell raiseEventImpl:method:args::] + 2060
Scholastic App       -[B4IShellBI raiseEvent:event:params:] + 1316
Scholastic App       __33-[B4I raiseUIEvent:event:params:]_block_invoke + 74
libdispatch.dylib    <redacted> + 10
libdispatch.dylib    <redacted> + 22
libdispatch.dylib    _dispatch_main_queue_callback_4CF + 718
CoreFoundation       <redacted> + 8
CoreFoundation       <redacted> + 1512
CoreFoundation       CFRunLoopRunSpecific + 476
CoreFoundation       CFRunLoopRunInMode + 106
GraphicsServices     GSEventRunModal + 136
UIKit                UIApplicationMain + 1440
Scholastic App       main + 116
libdyld.dylib        <redacted> + 2
)
 

Luiz Fernando Orlandini

Active Member
Licensed User
I don't think that this error message is related. What is line #18?
Erel, here is my Class... take a look

B4X:
Sub Process_Globals
    Private pg As Page
    Private DocType As String = "CPF"
    Private txtDocumentNumber As TextField
    Private txtEmail As TextField
    Private Loading As ActivityIndicator
End Sub

Public Sub Show
    If pg.IsInitialized = False Then
        pg.Initialize("pg")
        pg.RootPanel.LoadLayout("RecoverPassword")
    End If

    Main.NavControl.NavigationBarVisible = True
   
    Dim no As NativeObject = Main.NavControl
    no.GetField("navigationBar").RunMethod("setBarTintColor:", Array(no.ColorToUIColor(Colors.ARGB(Null, 3, 150, 204))))   
'    no.GetField("navigationBar").SetField("translucent", False)

    Main.NavControl.ShowPage(pg)
End Sub
Line 18 is: no.GetField("navigationBar").RunMethod("setBarTintColor:", Array(no.ColorToUIColor(Colors.ARGB(Null, 3, 150, 204))))
 
Top