iOS Question LargeTitle iOS 13 not display immediatly

Mike1970

Well-Known Member
Licensed User
Hi!
I'm using LargeDisplay in iOS13, but when the page display appears the title shows in standard mode, then if I scroll the tablview the title became large.
How can i display it immediatly large?

Code used:

B4X:
Sub navigationBarApperance(Controller As NativeObject, Page As Page, LargeTitle As Boolean)
    If Main.App.OSVersion >= 11 Then
        Dim noNavigationBar As NativeObject
        noNavigationBar = Controller
        noNavigationBar = noNavigationBar.GetField ("navigationBar")
        noNavigationBar.SetField ("prefersLargeTitles", LargeTitle)

        If Main.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)) 'Colore della navigation bar
    
            Dim mapInstance As Map
            mapInstance.Initialize
            mapInstance.Put ("NSColor", noNavigationBarAppearance.ColorToUIColor (Colors.Black)) 'Colore del titolo
            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.Black))
            'noNavigationBar.SetField ("translucent",   True)
        End If
    
           If LargeTitle Then
            Dim noViewController As NativeObject = Page
            noViewController.GetField ("navigationItem").SetField("largeTitleDisplayMode", 1) 'always
        End If
          
    End If
End Sub
Edit:
I think it's tableview fault, because if i comment all the initialization part of it, the large titles displays immediately


B4X:
Public Sub Initialize As Page
    page5pg.Initialize("page5pg")
    page5pg.RootPanel.LoadLayout("contactList_layout")
    page5pg.Title = "Chat"
    page5pg.HideBackButton = True
    
    tv.Initialize("tv", True)
    page5pg.RootPanel.AddView(tv, 0, 0, 100%x, 100%y)
    tv.RowHeight = 65 'must set RowHeight before adding custom views.
    
    tv.AddSection("Family", "")
    For i = 0 To 2
        Dim tc As TableCell = tv.AddSingleLine($"Pino ${i}"$) 'Usare il paramentro di AddSingleLine per metterci il Firebase ID!!
        tc.ShowSelection = False
        tc.CustomView = CreateItem(True, "Pino")
    Next
    
    tv.AddSection("Others", "")
    For i = 1 To 10
        Dim tc As TableCell = tv.AddSingleLine($"Jack ${i}"$)
        tc.ShowSelection = False
        tc.CustomView = CreateItem(False, "Jack")
    Next
    

    Main.NavControl.NavigationBarVisible = True
    General.navigationBarApperance(Main.NavControl, page5pg, True)
    Return page5pg
End Sub
 
Last edited:

Mike1970

Well-Known Member
Licensed User
Why aren't you using xCustomListView? Easier to work with, easier to customize and cross platform.
Because for what I have to show to the user is more coherent with the Apple UI , and I need to use the sections to split the content in different categories
 
Top