Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
808 views
in Technique[技术] by (71.8m points)

swift - iOS Bar Item image displaying wrong color

I have a bar with Bar Items, my .png image has green color, but when i add it to storyboard it's displaying as blue.

How can i make it display the image as it is?

enter image description here

enter image description here

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Use tintColor of UIBarButton to set the desired color for the image. If its absolutely necessary to use original image colors, use this to set the image:

[aBarButton setImage:[[UIImage imageNamed:@"xyz.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...