【发布时间】:2016-01-27 22:11:39
【问题描述】:
我有一个根 Tab Host Controller 和两个 Navigation Controller 选项卡兄弟姐妹:(1) 附近站点和 (2) 已保存站点。其中每一个都有一个View Controller。
我想执行从其中一个兄弟 View Controllers 到另一个 Navigation Controller 的转场,其中嵌入了 Stop Schedule View Controller,并满足以下要求:
- 根
Tab Bar不应显示在此View Controller的底部 - 在执行 segue 之前,我需要将
Stop对象传递给此视图控制器
目前,我正在以这种方式执行 segue,尽管 Tab Bar 不应该保留在 Stop Schedule View Controller 上。
func showStopSchedule(stop: Stop) {
let stopScheduleController = self.storyboard?.instantiateViewControllerWithIdentifier("StopScheduleViewController") as! StopScheduleViewController
stopScheduleController.stop = stop // pass data object
self.navigationController?.pushViewController(stopScheduleController, animated: true)
}
【问题讨论】:
-
为什么在停止计划控制器前面有额外的导航控制器?
-
我包含它是为了使标签栏不会包含在视图控制器中。
-
好的,所以删除它,然后在需要时使用我的答案中的代码隐藏标签栏。这也将使用户导航更简单,因为他们可以简单地回到他们开始的地方。 SwiftArchitect 也是正确的;您没有在情节提要中使用segue。可以使用
performSegueWithIdentifier和prepareForSegue通过站台
标签: ios swift uinavigationcontroller uitabbarcontroller xcode7