我有一个 UINavigationController
扩展,它向 navigationBar
添加了一个 rightBarButton
。我必须将它添加到 4 个 navigationControllers
,问题是其中 2 个显示正确,但其他 2 个按钮没有图像。该按钮适用于所有 4 个(即使是那些没有图像的)
func addReportButton() {
let reportImage = UIImage(named: "report_btn")
let reportButton = UIBarButtonItem(image: reportImage, style: .Plain, target: self, action: "reportButtonPressed")
navigationBar.topItem?.rightBarButtonItem = reportButton
}
以下是调试器的截图
最佳答案
好吧,问题是我有一些代码可以删除 navigationBar
下方的黑线,这是导致问题的原因
关于ios - UIImage 未显示在 UIBarButtonItem 上,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30645631/