Swift Custom NavBar Back Button Image and Text

后端 未结 12 1270
谎友^
谎友^ 2021-01-30 10:40

I need to customise the look of a back button in a Swift project.

Here\'s what I have:

Here\'s what I want:

I\'ve tried creating my own UIBarButtonItem

12条回答
  •  时光说笑
    2021-01-30 11:02

    You can do something like that:

    let yourBackImage = UIImage(named: "back_button_image")
    self.navigationController?.navigationBar.backIndicatorImage = yourBackImage
    self.navigationController?.navigationBar.backIndicatorTransitionMaskImage = yourBackImage
    self.navigationController?.navigationBar.backItem?.title = "Custom"
    

    Your image will only have one color though

提交回复
热议问题