我有这样的代码:切换回导航控制器的按钮
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作为新的根视图控制器 –