I've created a tab bar application. I have four tabs; on the selected tab, I need to set the color red for tab title. How can i do that?
Thanks in advance.
To change the text color for selected state, inside the TabBar widget, add the labelColor property and set the color. To change the text color for the unselected state, add the unselectedLabelColor parameter and change it colors.
Anyone who's looking for Swift 4 solution..
UITabBarItem.appearance().setTitleTextAttributes([NSAttributedStringKey.foregroundColor: .red], for: .selected)
This is what finally worked for me:
1)Selected text color
[[UIView appearance] setTintColor:someColor];
2)Unselected text(also changes image color)
[[UITabBar appearance] setTintColor:anotherColor];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With