我有這樣的代碼:切換回導航控制器的按鈕
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath)
{
let controller = SectionsController()
self.navigationController?.pushViewController(controller, animated: true)
}
在我的課:
class HomeController: UITabBarController,UITableViewDataSource,UITableViewDelegate, AddingProtocoleDelegate
,我想後退按鈕標題更改爲"Back"
我已經在控制器viewDidLoad部分嘗試了這一點:
self.navigationItem.backBarButtonItem?.title = "Back"
self.navigationController?.navigationBar.backItem?.title = "Back"
self.navigationController?.navigationItem.title = "Back"
let backButton = UIBarButtonItem(
title: "Back",
style: UIBarButtonItemStyle.plain,
target: nil,
action: nil
);
self.navigationController?.navigationBar.topItem?.backBarButtonItem = backButton;
但是任何解決方案都不起作用。
請幫忙。
你設置魯德視圖導航控制器? –
可能重複的[如何在導航欄中創建後退按鈕](http://stackoverflow.com/questions/16057327/how-to-create-back-button-in-navigation-bar) –
Nazmul,我設置了家控制器作爲根視圖控制器,但我不知道如何使用'.pushViewController'方法將sectioncontroller作爲新的根視圖控制器 –