How to set backButton text to empty?

孤街浪徒 提交于 2020-01-03 16:53:05

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!