适当的续流

Proper segue flow

我正在寻找执行以下操作的最佳实践方法:

我在 NavigationController 中嵌入了两个 TabBarController 视图,在 NavigationController 中嵌入了一个我不想作为选项卡包含在内的视图:

  1. FeedView(表ViewController)
  2. VenueView(集合ViewController)

  3. SelectView (ViewController)

在 VenueView (2) 中,我有以下代码来调出 SelectView (3):

override func collectionView(collectionView: UICollectionView, didSelectItemAtIndexPath indexPath: NSIndexPath) {

let selectVC: SelectViewController! = self.storyboard?.instantiateViewControllerWithIdentifier("selectVC") as! SelectViewController

selectVC.currentVenue = venueItems[indexPath.row]    
    presentViewController(selectVC, animated: true, completion: nil)

}

这个 segue 有效,但是 SelectView(3) 在顶部没有导航栏,尽管它嵌入在单独的 NavigationController 中。如果我将它连接到 IB 中的另一个 NavController,它 adopts/becomes BarTabController 中的第三个选项卡。我不要那个。

我如何连接它以便有一个 NavBar(带有一个可以返回任一视图的后退按钮)但没有 Tab?

此外,SelectView(3) 上还有一个按钮。当点击这个按钮时,我希望它继续到 FeedView(1) - 同时保留一些数据,即 'pushing into the feed'。我应该为此使用什么样的segue?我已经尝试了很多组合和 运行 到一些 st运行ge 错误,我发现视图管理非常混乱。

下面的故事板图片供参考 观看次数从上到下(1-3):

为了做到这一点,您需要解决您的问题,您需要像现在一样展示包含 SelectView 而不是 SelectView 本身的导航控制器。

您应该为您的第三个导航控制器设置故事板标识符并应用此更改:

let selectNavigationController = self.storyboard?.instantiateViewControllerWithIdentifier("selectNavigationController") as! UINavigationController
let selectVC = selectNavigationController.topViewController as! SelectViewController
selectVC.currentVenue = venueItems[indexPath.row]

presentViewController(selectNavigationController, animated: true, completion: nil)