我需要自定義Swift項目中後退按鈕的外觀。Swift自定義NavBar後退按鈕圖像和文本
我試圖創造我自己的UIBarButtonItem,但我無法弄清楚如何獲取圖像是旁邊的文字,而不是作爲背景或替代文字。
let backButton = UIBarButtonItem(title: "Custom", style: .Plain, target: self, action: nil )
//backButton.image = UIImage(named: "imageName") //Replaces title
backButton.setBackgroundImage(UIImage(named: "imageName"), forState: .Normal, barMetrics: .Default) // Stretches image
navigationItem.setLeftBarButtonItem(backButton, animated: false)
@Randy你的意思是讓一個UIView並添加標籤和ImageView的,並設置? – Conor