ios - UIImage 未显示在 UIBarButtonItem 上

标签 ios swift uiimage uinavigationbar uibarbuttonitem

我有一个 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
}

以下是调试器的截图

Screenshot only button Screenshot button and image

最佳答案

好吧,问题是我有一些代码可以删除 navigationBar 下方的黑线,这是导致问题的原因

关于ios - UIImage 未显示在 UIBarButtonItem 上,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30645631/

相关文章:

ios - 核心数据获取请求优化

ios - 导航 Controller 按下后的 View 高度不正确

ios - 从另一个 View Controller 访问数组数据

iphone - NSCoding持久化UIImage

ios - UIImage 和寻找中心像素的平均 UIColor

ios - 来自 UIAlertController 的键盘延迟关闭

Android ListView item点击事件监听引用当前activity委托(delegate)方法

swift - Swift 中 navinaviigationItem 中的搜索栏

swift - UITextView:达到固定宽度时自动换行

objective-c - 使用 PHImageManager,是否可以在一次调用中从一组 PHAssets 请求一组 UIImages?