Reputation: 719
I am trying to set a bigger font in the tab bar's title fields, but it doesn't work. What I tried changes the size of the icon and the font of the text field in the view. The title in the bar remains unchanged. As you can see I tried many ways (commented lines) and neither of them works.
struct DetailView: View {
var vehicle: Vehicle
var body: some View {
TabView {
DataView()
.tabItem {
Text("Dane")
.font(.system(size: 18.0, weight: .bold, design: .rounded))
Image(systemName: "list.bullet")
//.font(.system(size: 30)).bold()//(Font.system(.largeTitle, design: .rounded).weight(.heavy).bold())
}
RefuelingListView()
.font(.system(size: 20.0, weight: .bold, design: .rounded))
.tabItem {
Text("Wpisy")
.bold()
.font(Font.system(.largeTitle, design: .rounded).weight(.heavy))
Image(systemName: "list.bullet")
// .font(.system(size: 19))
}//.font(.largeTitle)
// }
// .textFieldStyle(PlainTextFieldStyle()).font(.system(size: 20))
// .onAppear() {
// UITabBar.appearance().tintColor = .red
}
//.font(Font.system(.largeTitle, design: .rounded).weight(.heavy))
}
}
Upvotes: 0
Views: 163
Reputation: 356
You can try adding a custom initializer for the tab bar like this:
struct DetailView: View {
var vehicle: Vehicle
init() {
UITabBarItem.appearance().setTitleTextAttributes([.font : UIFont.systemFont(ofSize: 20)], for: [])
}
var body: some View {
// Rest of code
}
}
Upvotes: 1