ios - 使用 Tabbar 管理 PushViewController

标签 ios swift uitabbarcontroller pushviewcontroller

我在 SecondViewController 中嵌入了 TabBar 我有一个 tableview 我想用 Didselect 推送 ViewController 并且还返回到secondViewController 带有导航后退按钮。

StoryBoardSetup

enter image description here

最佳答案

您可以使用 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/

相关文章:

iphone - UIActivityViewController 第一次卡住

swift - Xcode 6、Swift和mock验证无一异常(exception)

ios - 无法在导航栏上添加导航项

iPhone - 将标签栏与多个导航栏相结合

ios - CloudKit 公共(public)记录和更改未下载

ios - 在带有 secureTextEntry 的 iOS7 UITextField 中破坏其他文本字段中的布局

iphone - 使用 UI 自动化工具删除单元格的语法是什么?

ios - 单击并拖动 CGContext 绘图以将其放置在屏幕上的任意位置

ios - 链接依赖的 API 调用

ios - UITabBarController 与 UIViewControllers 和 UITableViewControllers