ios6 - segue 样式 "Replace"后缺少导航栏按钮项

标签 ios6 uistoryboard uistoryboardsegue uinavigationitem

我正在开发的 iPad 应用程序使用 Storyboards 和 segues。当用户单击主视图中的不同单元格时,我试图显示不同的 View Controller 。
在引用了不同的教程后,所采取的步骤是 -

  • Storyboard , Master View Controller ,为表格 View 创建静态单元格并添加 3 个不同的行(即单元格 1、单元格 2、单元格 3)
  • 添加了 View Controller ,选中它并附上 Navigation Controller给它(Editor -> Embed In -> Navigation Controller )
  • 来自 Master View 中的单元格 1| , 我在 Navigation Controller 上做了一个 ctrl-click .
  • 选择Segue Style “替换”和Destination “细节拆分”
  • 在 tableView:didSelectRowAtIndexPath 中,添加了 [self performSegueWithIdentifier:@"NewViewController"sender:self] 来进行转换。

  • 我看到的结果是详细 View 被替换。

    但是导航栏没有栏按钮项Master .

    所以我无法点击Master按钮将显示包含单元格的表格,我可以从中导航到不同的 View 。

    我已经阅读了许多博客并看到了有关替换 segue 以解决类似问题的评论。然而,似乎没有人在使用 Storyboard和转场时遇到过这个特定问题。

    根据我的理解,使用 segues 应该可以帮助我实现我想要的。从那些尝试过这种方法的人那里,任何指向正确方向的指针都会有所帮助。

    最佳答案

    尝试更改 Segue Style来自 ReplacePush .它应该可以解决您的问题。

    当您推送 UIViewControllerUINavigationController ,它将被添加到堆栈中,您将能够向后导航:

    点击“详细信息”之前的导航 Controller 堆栈:

    Master
    

    点击详细信息并进行更多导航后您的导航 Controller ...:
    Master -> Detail (Navigation button is displayed) -> Some other details (Navigation button is displayed) -> And maybe some more (Navigation button is displayed)
    

    当您使用 Replace 调用新的 segue 时像你一样,Master将替换为 Detail ,并且您将无法返回,因为 Master 已被替换并且它不再在堆栈中。

    点击“详细信息”之前的导航 Controller 堆栈:
    Master
    

    像您一样使用替换点击详细信息后的导航 Controller :
    Detail (no navigation button because master was replaced and we don't have nothing more on the stack)
    

    关于ios6 - segue 样式 "Replace"后缺少导航栏按钮项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14361169/

    相关文章:

    iphone - 将数据传递给 subview

    iphone - 如何经常检查 GPS 信号强度

    ios - 从开发者的角度来看,各个 iOS 版本之间有什么区别?

    iphone - iOS 7 中的 UIView 显示问题

    ios - 类型转换 UIViewcontroller,最终成为

    ios - 使用 Storyboard时 GIDSignInButton 未加载 Google Plus.bundle

    ios - awakeFromNib、导出和 Storyboard : is the documentation wrong?

    swift - 展开后 TableView 消失

    ios - 用动画替换 root-view-controller 自定义 segue?

    swift - Segue 转换到错误的页面 Swift Xcode