How to remove all navigationbar back button title

后端 未结 30 3424
后悔当初
后悔当初 2020-12-12 15:42

When I push a UIViewController, it has some title in back button at new UIViewController, if the title has a lot of text, It does not look good in

30条回答
  •  死守一世寂寞
    2020-12-12 15:59

    I usually add or change the back button in viewDidLoad of the UIViewController.

    Something like that should work:

    let leftButton = UIBarButtonItem(title: "Back", style:     UIBarButtonItemStyle.Plain, target: self, action: "closeView:")
    self.navigationItem.leftBarButtonItem = leftButton
    

    Don't forget to change and implement the function that it's called to close the view.

    Even easier, just change the title:

    self.navigationItem.leftBarButtonItem.title = "Back"
    

提交回复
热议问题