【发布时间】:2017-07-13 16:03:31
【问题描述】:
顺序是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
}
【问题讨论】: