I am using tabview more than 5 tabs. On sixth tab it showing "More" option I want to hide More Option Button On Navigation Bar
I am using tabview more than 5 tabs on sixth tab it showing "More" option I want to hide it
I want to hide More Option Button
AFAIK, you cannot.
.
I am using tabview more than 5 tabs.
What do you want to do with tabs 6 and over ?
A solution is to have just 5 tabs and some of them calling a new tabBar…
That's unfortunate. There are very popular apps that have use cases with 6-7 items in their tabview.
If you have a custom TabView and using a system one for rendering screen content, then you can use the tabViewStyle modifier to hide the more button that showing up on navbar. For example:
struct ContentView: View {
let tabBarItems = TabBarItem.allCases // A custom enum array including all possible tabs
@State var selected: TabBarItem = .home // Selected TabBarItem
var body: some View {
// ...
TabView(selection: $selected) {
Group {
Text("First Screen")
.tag(bottomBarItems[0])
Text("Second Screen")
.tag(bottomBarItems[1])
}
.toolbar(.hidden, for: .tabBar) // Hide system tabBar
}
.tabViewStyle(.page(indexDisplayMode: .never)) // @See: https://developer.apple.com/documentation/swiftui/pagetabviewstyle
CustomTabBar(bottomBarItems, selected: $selected) // Render your custom TabBar
}
}
}
}