The problem: When I lunch the app, the first tabview doesn't display the name below. I have to go to another view and come back for it to show. Why?
struct MotherView : View {
var body: some View {
VStack {
if viewRouter.currentPage == "onboardingView" {
OnboardingView()
} else if viewRouter.currentPage == "homeView" {
TabView {
HomeView()
.tabItem {
Image(systemName: "house")
Text("Menu")
}
SettingsView()
.tabItem {
Image(systemName: "slider.horizontal.3")
Text("Order")
}
}
}
}
}
}
We can just guess, because you didn't show us the code of your HomeView. Nevertheless I guess in your HomeView you have this line .navigationBarTitle("", displayMode: .inline)
.
Remove it and it will work as expected.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.