2017-06-25 53 views
0

想要設置在模擬器中顯示的圖像的大小,因爲它出現遠大到我已經嘗試了許多事情無濟於事?swift xcode更改尺寸爲navigationItem.leftBarButtonItem = UIBarButtonItem

func CancelButton(){ 
    navigationItem.leftBarButtonItem = UIBarButtonItem(image: 
#imageLiteral(resourceName: "HOME BUTTON BLACK").withRenderingMode(.alwaysOriginal), style: .plain, target: self, action: #selector(handleCancel)) 

} 

func handleCancel() { 
    self.dismiss(animated: true, completion: nil) 
}// handleCancel 

回答

0

您需要一個較小的圖片!

您可以在代碼中執行此操作,也可以用較小的代碼替換當前圖像。

對於酒吧按鈕項目,最佳尺寸大約是25x25,所以請嘗試調整它的大小。

要做到這一點代碼,你可以參考這answer