问题
I tried this code:
navigationController?.navigationItem.backBarButtonItem?.title = ""
but it does not work and did not change anything. How can I set backButton text to empty?
回答1:
I tried this code for back button title. and it's work correctly
let barButton = UIBarButtonItem()
barButton.title = ""
self.navigationController?.navigationBar.topItem?.backBarButtonItem = barButton
回答2:
self.navigationController!.navigationBar.topItem!.title = ""
回答3:
You should use:
navigationItem.backBarButtonItem = UIBarButtonItem(title: "", style: .Plain, target: nil, action: nil)
for see just < instead of < viewController
回答4:
You have to change the previous controller's title, try doing so before the segue in the viewDidDisappear
回答5:
To remove the backButtonItem
's title, place this line of code in the viewDidLoad:
of the View Controller
that the backButtonItem
is in:
navigationItem.backBarButtonItem = UIBarButtonItem(title: "", style: .Plain,
target: nil, action: nil)
回答6:
self.navigationItem.leftBarButtonItem=nil;
or
self.navigationItem.backBarButtonItem=nil;
来源:https://stackoverflow.com/questions/34288419/how-to-set-backbutton-text-to-empty