Domanda

I am aware of tintcolor property of UINavigationBar and it is set to its default in my project. This way the icons on this bar have blue color.

But when I add same icons in UITableViewCells, they are of grey (original png) color.

Is there a way to make it have same color as the ones on the Navigation Bar?

È stato utile?

Soluzione

In iOS7 you can use a new property in order to redraw an UIImage so you can have it with the same color as the tint color.

Here is an example:

UIImage *backButtonImage = [UIImage imageNamed:@"imageName.png"];
backButtonImage = [backButtonImage imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];

Finally you will need to set either the setTintColor property of the object where you adding that UIImage or the property in the whole project.

Hope this helps!

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top