UIBarButtonItem is blue instead of image

南楼画角 提交于 2019-12-01 08:04:19

You can use renderingMode for your custom image with AlwaysOriginal mode. See below code for solved it.

self.navigationController?.navigationBar.backIndicatorImage = UIImage(named: "back")?.imageWithRenderingMode(.AlwaysOriginal)
self.navigationController?.navigationBar.backIndicatorTransitionMaskImage = UIImage(named: "back")?.imageWithRenderingMode(.AlwaysOriginal)

Hope that helps!

Quickest solution

.navigationController?.navigationBar.tintColor = UIColor.redColor()

Or you can create custom barButton item, with custom view

Set the tintColor property of the barbuttonItem.

self.navigationItem.backBarButtonItem.tintColor = "any color"
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!