UIBarButtonItem image stays blue and not the original color of the image? UIBarButtonItem image stays blue and not the original color of the image? xcode xcode

UIBarButtonItem image stays blue and not the original color of the image?


By default, image in UINavigationBar's bar button items is rendered using template mode. You can set it to original.

self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[[UIImage imageNamed:@"info.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]                                                                         style:UIBarButtonItemStylePlain                                                                        target:self                                                                        action:@selector(info:)];


Swift 3:

let image : UIImage? = UIImage.init(named: "heart.png")!.withRenderingMode(.alwaysOriginal)


I know this is too late to answer this question but I see there is a very simple way to solve this issue instead of doing some changes in the code

using Xcode Go to the Assets --Select Image --- check Render as and select Original image instead of default property .

enter image description here