How to have individual selected image color for Ta

2019-03-05 05:35发布

问题:

I've been through most to all of these SO Q/A and none of which worked; many refers to older version of xcode.

I'm using Xcode 8. I have a TabBarItem with a red image. Other item image will have a different color. For the first item, the selected image is originally red. When I run the app, it's blue -- it should be selected as red, why it's blue?

In Story Builder -> Identity Inspector -> Runtime attr, I have tintColor - Color - (red color). None of that worked. My image is red so why it's not red? Do I need to disable a default setting somewhere?

Is there a way when I select any image, it shows the original color it was saved?

A post's comment mentioned setting the image in viewDidLoad is bad. Is that true? I've tried that and it's still selected blue.

This question is about selected image.

Thanks

回答1:

When I run the app, it's blue -- it should be red, why it's blue?

That's because blue is the tint color. If you want to use the red of the original image, and not the tint color, turn the image into a rendered image with rendering mode alwaysOriginal. If this is supposed to be the color only when the tab bar item is selected, supply it as the selectedImage.



标签: xcode xcode8