我有一個導航控制器的根目錄控制器。然後我推一個標籤欄視圖控制器。後退按鈕消失。如何通過後退按鈕將標籤欄視圖控制器返回到主視圖控制器?我怎樣才能讓它再次可見?如何在選項卡視圖控制器中顯示返回按鈕?
我曾嘗試:
let navItem = self.navigationController?.navigationItem
let navItem2 = self.navigationItem;
leftBarButton = UIBarButtonItem()
leftBarButton.image = UIImage(named: "arrows-back-icon-24.png")
leftBarButton.action = #selector(self.popViewController);
leftBarButton.target = self
navItem?.leftBarButtonItem = leftBarButton
navItem2.leftBarButtonItem = leftBarButton;
我也試過:
let navItem = self.navigationController?.navigationItem
let navItem2 = self.navigationItem;
navItem?.leftBarButtonItem = nil;
navItem2.leftBarButtonItem = nil;
所有不工作。請幫忙。謝謝。
你需要做'tabBarViewController'爲'rootViewController' –
是你這樣的流量? UINavigationController - > UIViewController(你的主vc) - > UITabBarController。 –
嘗試更改爲leftBarButton.action = #selector(self.navigationController?.popViewController)。但首先你需要確認工作流UINavigationController - > UIViewController(Home) - > UITabBarController – wskcoder