Morning ya'll. I've designed a tab bar and managed to customise it with custom tab bar items but i can't figure out how you get the tab bar items to load in their original picture color when view is loaded. My code looks like this:
class GamePage: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
tabBarItem.image = tabBarItem.image?.withRenderingMode(.alwaysOriginal)
tabBarItem.selectedImage = tabBarItem.selectedImage?.withRenderingMode(.alwaysOriginal)
}
which gives this outcome:
after clicking on the tab bar items i get the desired effect, but what i want is when the app launches and the first view is loaded to have the tab bar items in color like so:
Guys my solution got answered on Stackoverflow and it goes like this so we have a copy here for posterity:
- got to assets folder in Xcode
- select the images to be have their properties changed
- in the inspector on the right side change the Render As value to original
Picture with detailed view:
How to do it programatically that's still a mystery, but if I find a solution I'll place it here.
PS: if somebody has the programatic solution please post here and don't consider this thread closed yet.