Swift 3
First of all, make sure you have added the BOOLEAN key "View controller-based status bar appearance" to Info.plist, and set the value to "NO".
Appdelegate.swift
Insert code somewhere after "launchOptions:[UIApplicationLaunchOptionsKey: Any]?) -> Bool {"
- Change the color of the tab bar itself with RGB color value:
UITabBar.appearance().barTintColor = UIColor(red: 0.145, green: 0.592, blue: 0.804, alpha: 1.00)
OR one of the default UI colors:
UITabBar.appearance().barTintColor = UIColor.white)
- Change the text color of the tab items:
The selected item
UITabBarItem.appearance().setTitleTextAttributes([NSForegroundColorAttributeName: UIColor.white], for: .selected)
The inactive items
UITabBarItem.appearance().setTitleTextAttributes([NSForegroundColorAttributeName: UIColor.black], for: .normal)
- To change the color of the image, I believe the easiest approach is to make to separate images, one for each state.
If you don´t make the icons from scratch, alternating black and white versions are relatively easy to make in Photoshop.
Adobe Photoshop (almost any version will do)
Make sure your icon image has transparent background, and the icon itself is solid black (or close).
Open the image file, save it under a different file name (e.g. exampleFilename-Inverted.png)
In the "Adjustments" submenu on the "Image" menu:
Click "Invert"
You now have a negative of your original icon.
In XCode, set one of the images as "Selected Image" under the Tab Bar Properties in your storyboard, and specify the "inactive" version under "Bar Item" image.
Ta-Da 🍺