UINavigationController “back button” custom text?

后端 未结 16 1494
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:33

    rein's answer works well.

    Note that if you push more than one view controller, the changed back button title will appear for each of them, which may not be what you want.

    In that case, you'll need to create the custom UIBarButtonItem each time you push a view controller.

    Also, make sure you do it before pushing the view controller, otherwise you will get a screen hiccup as the title changes.

提交回复
热议问题