HomeiOS Developmentios - Tips on how to set a navigation title with a...

ios – Tips on how to set a navigation title with a tab view


Hi I’m scuffling with set navigation titles with SwiftUI.

What I ought to do might be to set the navigation title to the LIST in BrowseWordsView() and I additionally don’t need to set it to ContentView(). I attempted including the navigationTitle modifier on to the BrowseWordsView() nevertheless it didn’t work.

How can I obtain the navigation title just like the pic under? The title “Browse” will grow to be very small and transfer to the highest centre of the display as soon as the display is scrolled down. Thanks. NavigationTitleSmall
NavigationTitleBig

enum Tabs: String{
    case research
    case browse
    case search
}

NavigationStack {
            TabView(choice: $selectedTab) {
                // 1st view
                ContentView()
                // set the image and the title
                    .tabItem { Label("Examine", systemImage: "pencil.line") }
                    .tag(Tabs.research)
                
                // 2nd view
                BrowseWordsView(viewModel: SearchedWordsObject(service: ExploreService()))
                // set the image and the title
                    .tag(Tabs.browse)
                    .tabItem { Label("Browse", systemImage: "guide.pages") }

                // third view
                SearchView()
                // set the image and the title
                    .tag(Tabs.search)
                    .tabItem { Label("Search", systemImage: "magnifyingglass") }
            }
            .navigationTitle(selectedTab.rawValue)
            .navigationBarTitleDisplayMode(.massive)
            .navigationBarBackButtonHidden()

#BrowseWordsView
ScrollView {
      Checklist(uniqueWords.sorted()) { distinctive in
            HStack {} 

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments