我在 SecondViewController
中嵌入了 TabBar 我有一个 tableview 我想用 Didselect
推送 ViewController
并且还返回到secondViewController
带有导航后退按钮。
StoryBoardSetup
最佳答案
您可以使用 Storyboard 中的唯一标识符为您想要的每个转换创建到导航 Controller 的转场。
然后你可以在 didSelect
中使用 performSegue
手动调用转换:
self.performSegue(withIdentifier: "Identifier", sender: self)
并且因为您将 View 嵌入到导航 Controller 中,所以您不需要处理后退按钮,它会自动处理。
您还可以通过覆盖 perepareForSegue
来设置下一个 View Controller 属性:
override func prepareForSegue(segue: UIStoryboardSegue!, sender: AnyObject!) {
if (segue.identifier == "Identifier") {
let destination = segue.destination as! YourViewController
// pass data to next view
}
}
关于ios - 使用 Tabbar 管理 PushViewController,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55204696/