I have a custom UITabBar and I'm trying to customise the UITabBarItem. I have selected two sets of images for selected and unselected states of the two bar items. The selected images are plain green, the unselected ones are clear with green borders. The problem is that when I run the application, the second item (the one starting unselected) is gray. When I press it, it turns to plain green and the first one to clear with green borders and then, when I repress the first item, the second one turns clear with green borders as expected. So I have a problem with colors when loading.
I have tried modifying the tint color of my tab bar but it doesn't seem to work. Here's my code, called in the viewDidLoad of both the view controllers related to the tab bar items:
tabBarItem.selectedImage = UIImage(named: "LocationTabBarOn")?.withRenderingMode(.alwaysOriginal)
tabBarItem.image = UIImage(named: "LocationTabBarOff")?.withRenderingMode(.alwaysOriginal)
tabBarItem.selectedImage = UIImage(named: "FavoritesTabBarOn")?.withRenderingMode(.alwaysOriginal)
tabBarItem.image = UIImage(named: "FavoritesTabBarOff")?.withRenderingMode(.alwaysOriginal)