UIBarButtonItem is blue instead of image

前端 未结 3 1363
既然无缘
既然无缘 2021-01-14 08:52

Here is what I have in my viewDidLoad method:

self.navigationController?.navigationBar.backIndicatorImage = UIImage(named: \"back\")
self.navigationControlle         


        
相关标签:
3条回答
  • 2021-01-14 09: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!

    0 讨论(0)
  • 2021-01-14 09:20

    Quickest solution

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

    Or you can create custom barButton item, with custom view

    0 讨论(0)
  • 2021-01-14 09:25

    Set the tintColor property of the barbuttonItem.

    self.navigationItem.backBarButtonItem.tintColor = "any color"
    
    0 讨论(0)
提交回复
热议问题