UINavigationController “back button” custom text?

后端 未结 16 1485
Happy的楠姐
Happy的楠姐 2020-11-28 01:41

The \"back button\" of a UINavigationController by default shows the title of the last view in the stack. Is there a way to have custom text in the back button

16条回答
  •  清歌不尽
    2020-11-28 02:17

    I know this is an old question and the answers' kind of out updated!

    The easy way is to do this in parent ViewController:

    i.e the one that takes you to next view controller.

    self.navigationItem.backBarButtonItem  = UIBarButtonItem(title: "Custom text here", style: .plain, target: nil, action: nil)
    

提交回复
热议问题