Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/18.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios UIImage未显示在UIBarbuttonite上_Ios_Swift_Uiimage_Uinavigationbar_Uibarbuttonitem - Fatal编程技术网

Ios UIImage未显示在UIBarbuttonite上

Ios UIImage未显示在UIBarbuttonite上,ios,swift,uiimage,uinavigationbar,uibarbuttonitem,Ios,Swift,Uiimage,Uinavigationbar,Uibarbuttonitem,我有一个UINavigationController扩展,它向导航栏添加了一个rightBarButton。我必须将它添加到4个导航控制器中,问题是其中2个显示正确,而另2个按钮没有图像。按钮适用于所有4种情况(即使是没有图像的情况) 以下是调试器的屏幕截图 问题是,我有一些代码删除了导航栏下方的黑线,这就是问题的根源 func addReportButton() { let reportImage = UIImage(named: "report_btn") let rep

我有一个
UINavigationController
扩展,它向
导航栏添加了一个
rightBarButton
。我必须将它添加到4个导航控制器中,问题是其中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
}