在UINavigationBar
中,我在storyboard
中设置了右栏项目图像。轻按highlighted
。我想通过将“突出显示的调整图像”设置为false来禁用突出显示。如何访问此属性?
答案 0 :(得分:0)
您可以将withRenderingMode(UIImage.RenderingMode.alwaysOriginal)
用于图像来解决此问题:
let img = UIImage(named: "picture")!.withRenderingMode(UIImage.RenderingMode.alwaysOriginal)
let rightBarButtonItem = UIBarButtonItem(image: img, style: UIBarButtonItem.Style.plain, target: self, action: nil)
self.navigationItem.rightBarButtonItem = rightBarButtonItem