Reputation: 3172
I am customizing the tab bar, and I don't my items to be highlighted with the tint color set to the tab bar item. I wan't the highlight to be just the image that I set for the selectedImage property of the tab bar item.
This is what it looks like now
I don't want my image to be highlighted with blue. I want it to be just the image that I set.
Please don't tell me about changing tint colors. I am not asking about tint colors here.
Upvotes: 0
Views: 1559
Reputation: 6992
As per UITabBarItem documentation for init(title:image:selectedImage:) initializer:
By default, the actual unselected and selected images are automatically created from the alpha values in the source images. To prevent system coloring, provide images with alwaysOriginal
So, in your case:
let yourTabBarItem = UITabBarItem(title: yourTitle, image: yourImage.withRenderingMode(.alwaysOriginal), selectedImage: yourSelectedImage.withRenderingMode(.alwaysOriginal))
Upvotes: 4