iOS Question Black background on iOS 13 for Large Titles

LucianDesign

Member
Licensed User
Longtime User
Hello,
I've used the code bellow to set the large title on iOS ... but starting with iOS13 I get a black background.
Anyone has an idea how to fix it?

B4X:
If App.OSVersion >= 11 Then
        Dim NObj As NativeObject = NavControl
        Log(NObj.GetField("navigationBar"))

        NObj.GetField("navigationBar").SetField("prefersLargeTitles", True)
        NObj.GetField("navigationBar").SetField("BarTintColor", NObj.ColorToUIColor(Colors.White))
        NObj.GetField("navigationBar").SetField("TintColor", NObj.ColorToUIColor(Colors.White))
        NObj.GetField("navigationBar").SetField("translucent", False)
        NObj = Page1
        NObj.GetField("navigationItem").SetField("largeTitleDisplayMode", 1) 'always
        
 End If
 

LucianDesign

Member
Licensed User
Longtime User
Hello,
No, I don't have the dark theme ON.
I've also added the PlistExtra and still the same result.

P.S. I'm using the cloud builder.

B4X:
#PlistExtra: <key>UIUserInterfaceStyle</key><string>Light</string>

iphone.jpg
 
Upvote 0

Semen Matusovskiy

Well-Known Member
Licensed User
You need to look UINavigationBarAppearance.
As I understood, you want black title on white background.
Try this

B4X:
If App.OSVersion >= 11 Then
        Dim noNavigationBar As NativeObject
        noNavigationBar = NavControl
        noNavigationBar = noNavigationBar.GetField ("navigationBar")
        noNavigationBar.SetField ("prefersLargeTitles", True)

        If App.OSVersion >= 13 Then
            Dim noNavigationBarAppearance As NativeObject
            noNavigationBarAppearance =    noNavigationBarAppearance.Initialize ("UINavigationBarAppearance").RunMethod ("new", Null)
            noNavigationBarAppearance.RunMethod ("configureWithOpaqueBackground", Null)
            noNavigationBarAppearance.SetField ("backgroundColor", noNavigationBarAppearance.ColorToUIColor (Colors.White))
       
            Dim mapInstance As Map
            mapInstance.Initialize   
            mapInstance.Put ("NSColor", noNavigationBarAppearance.ColorToUIColor (Colors.Black))
            noNavigationBarAppearance.SetField ("titleTextAttributes", mapInstance.ToDictionary)
            noNavigationBarAppearance.SetField ("largeTitleTextAttributes", mapInstance.ToDictionary)
               
            noNavigationBar.SetField ("standardAppearance", noNavigationBarAppearance)
            noNavigationBar.SetField ("scrollEdgeAppearance", noNavigationBarAppearance)
        Else           
              noNavigationBar.SetField ("barTintColor", noNavigationBar.ColorToUIColor (Colors.White))
            noNavigationBar.SetField ("tintColor",     noNavigationBar.ColorToUIColor (Colors.White))
            noNavigationBar.SetField ("translucent",   False)
        End If
       
        Dim noViewController As NativeObject = Page1
        noViewController.GetField ("navigationItem").SetField ("largeTitleDisplayMode", 1) 'always       
    End If
 
Upvote 0
Top