Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

disable tint on custom uibarbuttonitem images

i have some custom bar button items in my navigation controller.

enter image description here

(maximize the image to see the borders better)

the above screenshot is how it should look like and how i added the barbutton item image. as you can see, the icon has some darker gradients on top.

but since all icons get tinted, this dark gradient gets also tinted white and my icon looks extremely blurry.

i just dropped them into my storyboard.

enter image description here

is there a way to disable tinting this barbuttonitems?

like image 636
choise Avatar asked Mar 18 '14 14:03

choise


2 Answers

In iOS 7, a navigation bar’s tintColor affects the color of the back indicator image, button titles, and button images. The barTintColor property affects the color of the bar itself. So, you can try setting the barTintColor and check if it solves your issue.

Also, when using the barButtonItem images, the following code is worth a try:

myImage = [myImage imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
like image 158
Anindya Sengupta Avatar answered Nov 10 '22 14:11

Anindya Sengupta


Adding to Anindya Answer:

In Xcode 9.2,

You can change the "Render As" property to "Original" in Attribute Inspector of Assets. This will prevent NavigationBar.TintColor to take effect on that Image if you used it in UIBarButtonItem

like image 31
Zaid Mirza Avatar answered Nov 10 '22 14:11

Zaid Mirza