【发布时间】:2016-10-04 18:41:23
【问题描述】:
我正在制作一个 swift 应用程序,我从 UIViewController(我的登录屏幕)转到带有根视图(主屏幕登录后)的 UINavigationController。这一切都很好,所有必要的数据都被传递到根视图。我的问题是,在我单击 UITableViewController 上的一个单元格后,它会将我带到下一个 UIViewController 但没有导航栏(所以我无法返回)。
我也尝试过取消隐藏导航栏,但没有成功,我真的认为它不存在。
我不确定这些是否是导致问题的提示,但这是我在调试器中收到的一些警告 Warning messages
这是我的故事板的结构 My storyboard
这是我从登录到主屏幕的代码
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
if segue.identifier == "segueToTeams" {
if let user = self.user{
let navController = segue.destinationViewController as! UINavigationController
let welcomeView = navController.topViewController as! TeamsTableViewController
welcomeView.user = user
}
}
}
func goToTeamsView(storyBoard : UIStoryboard){
let welcomeView = storyBoard.instantiateViewControllerWithIdentifier("teamsView")
let navigationController = UINavigationController(rootViewController: welcomeView)
super.performSegueWithIdentifier("segueToTeams", sender: self)
super.presentViewController(navigationController, animated: true, completion: nil)
}
最后,这是我的代码,从 UINavigationViewController 的根视图控制器(在故事板屏幕截图中选择团队视图)到下一个(单个团队视图控制器)应该有导航栏但没有
override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
performSegueWithIdentifier("selectTeamCellSegue", sender: indexPath.row)
}
如果您需要任何其他信息,请告诉我。我一直在努力解决这个问题比我想承认的要长,任何帮助/建议将不胜感激!
【问题讨论】:
标签: swift uiviewcontroller uinavigationbar segue