序列是tabBarController-> navigationController-> viewController-> viewController 我在第二个viewController中编写了以下代码。 当用户访问第二个viewController时,我想隐藏标签栏。
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
self.tabBarController?.tabBar.isHidden = true
}
当用户点击"取消"按钮,我想回到主页面。
@IBAction func cancelAction(_ sender: Any) {
// Depending on style of presentation (modal or push presentation), this view controller needs to be dismissed in two different ways.
self.navigationController?.popToRootViewController(animated: true)
}
回到第一个viewController后,我想再次显示标签栏。
override func viewWillAppear(_ animated: Bool) {
self.tabBarController?.tabBar.isHidden = false
}