I'm trying to change the color of the unselected item images in my Tab Bar from the default gray color to the actual color of the image (white), but my efforts have been unsuccessful. There are several threads related to this question on Stack Overflow, but many of them seem to be outdated.
Tab Bar with Home and Profile icons
As you can see from the picture, the unselected Profile icon on the right has a default gray color. After doing some research, I've tried running the solution below in the App Delegate file to change its color to white, but sadly this hasn't worked. I'm a novice Swift programmer (incidentally, this is also my first post), so any help or suggestions would be greatly appreciated.
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
let tabBarController = UITabBarController()
tabBarController.tabBar.unselectedItemTintColor = .white
return true
}
Make the icon images Black, if they are white Im not sure it will work. As in the actual image themselves should be black in the assets folder not white.
If you add a tabbar from the story board you can put these line of code in that method in the appDelegate method shown in your post
UITabBar.appearance().barTintColor = UIColor.black
UITabBar.appearance().tintColor = UIColor.red
UITabBar.appearance().unselectedItemTintColor = .white