How to change text on a back button

前端 未结 20 2091
无人及你
无人及你 2020-11-29 17:24

By default the back button uses as a text on it a title of a viewcontroller. Can I change text on the back button without changing a title of a view controller? I need this

20条回答
  •  旧巷少年郎
    2020-11-29 17:56

    Marc W's approach worked great once I figured out which controller to apply it to: the one being re-titled, not the one on top. So if this is the navigation stack:

    (bottom)  ControllerA -> ControllerB  (top)
    

    ...and you want to give a shorter title for ControllerA in the back-button displayed when ControllerB is on top, you apply the property change to ControllerA.

    So it's more in the context of self.title, not like the other left/right-bar-button setters.

提交回复
热议问题