Changing Tint / Background color of UITabBar
Master System Design with Codemia
Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.
Introduction
Changing the appearance of a UITabBar is easy to do incorrectly because Apple’s APIs changed significantly in newer iOS versions. Older code often sets barTintColor and tintColor directly, while modern code should usually use UITabBarAppearance. The correct implementation depends on the iOS version you support and whether you want a global style or a single-tab-bar customization.
Know What Each Color Property Controls
Different properties affect different parts of the tab bar:
- '
tintColorcontrols the selected item color.' - '
unselectedItemTintColorcontrols unselected item color.' - Background appearance controls the bar’s visible background.
If you change only one of these, the result may look inconsistent.
Modern iOS Approach with UITabBarAppearance
For iOS 13 and later, UITabBarAppearance is the preferred API.
This approach is explicit and stable across most modern UIKit setups.
Older Direct Property Approach
For older iOS support or quick one-off styling, direct properties still appear in legacy code.
This can still work, but modern appearance APIs are usually more predictable, especially when integrating with navigation bars and scroll-edge behavior.
Global Appearance Versus One Controller
If every tab bar in the app should look the same, you can configure UITabBar.appearance().
Use this carefully. Global appearance rules affect every matching tab bar and can be hard to override later.
Transparent and Blurred Backgrounds
If you want a translucent or transparent look, do not just set a clear background color and hope for the best. Use the appearance configuration intentionally.
This produces more reliable results than mixing older tint properties with transparent colors.
Selected and Unselected Item Styling
Customizing background color alone is not enough. You usually need selected and unselected item colors that maintain contrast.
Poor contrast makes tab labels unreadable and hurts accessibility. Always test against light and dark content beneath the bar if the background is translucent.
Storyboard and Lifecycle Placement
Set tab bar appearance in a place that matches ownership:
- In a custom
UITabBarControllerfor controller-specific styling. - In app startup for global styling.
Avoid scattering tab bar styling across child view controllers. That creates inconsistent behavior and makes debugging much harder.
Debugging Appearance Problems
If styling changes do not appear:
- Confirm the code runs before the tab bar is shown.
- Check whether another global appearance rule overrides your changes.
- Check
scrollEdgeAppearanceseparately on newer iOS versions.
Many "not working" cases are actually standardAppearance and scrollEdgeAppearance not being configured consistently.
Common Pitfalls
- Changing only
tintColorand expecting the whole tab bar background to change. - Using legacy
barTintColorcode on modern iOS without checking appearance APIs. - Setting
standardAppearancebut forgettingscrollEdgeAppearance. - Applying styles in child controllers instead of the tab bar controller.
- Choosing colors with poor contrast for selected or unselected states.
Summary
- '
tintColoraffects selected items, not the full bar background.' - On modern iOS, prefer
UITabBarAppearanceover old direct color properties. - Configure both
standardAppearanceandscrollEdgeAppearancefor consistent results. - Use global appearance only when the whole app truly shares one style.
- Test contrast and visibility, not just color assignment.

