Custom back button in UINavigationController

前端 未结 10 1850
伪装坚强ぢ
伪装坚强ぢ 2020-12-28 16:59

For an application I\'m developing, I need to display a custom back button in a navigation bar. I have the button asset as a PNG image, and I\'m writing this code:



        
10条回答
  •  难免孤独
    2020-12-28 17:51

    Isn't the simplest solution just to design it from your storyboard with whatever image or colors you want, and just drag a new action to your controller?

    Swift Code

    @IBAction func backButton(sender: AnyObject) {
        self.navigationController?.popViewControllerAnimated(true)
    }
    

提交回复
热议问题