使用错误的动画和后退按钮未显示的 Segue

Segue using wrong animation and back button not showing up

我在项目中的 UITabBarController 中使用了 UINavigationController。 在这个 UINavigationController 里面有一个 UICollectionView。在 UICollectionView 中,点击 collection 中的项目后,应执行 show segue 以查看某种详细信息页面,您可以从那里返回或应用不同 data-filter 的另一个 collection。

作为 iOS 开发的新手,我很难让事情按照我想要的方式运行。即使所有的 segues 在故事板中都设置为 show,它们也会作为模态动画进行动画处理(从底部而不是右侧进入)。

后退按钮也没有出现。我在属性检查器中为它设置了文本(我已经知道这些必须在 'goes away' 的视图中)并且还为所有导航项添加了标题......仍然没有显示它们的迹象。

这是我的故事板:

这是我使用的prepareForSegue

override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
    if segue.identifier == "showService" {
        if let indexPath = self.collectionView?.indexPathsForSelectedItems() {
            let object = serviceData[indexPath.last!.row]
            let controller = (segue.destinationViewController as! UINavigationController).topViewController as! ServiceDetailViewController
            controller.serviceItem = object
            controller.callerItem = self.name
            controller.navigationItem.leftItemsSupplementBackButton = true
        }
    }
}

我在 collection 视图的 collectionView:didSelectItemAtIndexPath: 中触发了 segue:

override func collectionView(collectionView: UICollectionView, didSelectItemAtIndexPath indexPath: NSIndexPath) {
    let cell = self.collectionView?.cellForItemAtIndexPath(indexPath)
    performSegueWithIdentifier("showService", sender: cell)
}

问题是您的 运行 从导航控制器的 child ("Another Title") 到 导航控制器。这不是您在导航界面中构建 push/show segue 的方式。您需要 运行 从导航控制器的 child 到 另一个 child,即,例如到您的 "Title" 视图控制器。因此,如果(假设)你的 push/show segue 运行s 从 "Another Title" 到 "Title",那么当那个 segue 被触发时, "Title" 视图控制器将是推入与 "Another Title" 视图控制器相同的导航控制器堆栈,因此您将在导航栏和后退按钮中看到标题更改。