title: Embed multiple view controllers in navigation controller
body: <p>I'm making an app for iOS based partly on storyboards and programmatically setup. The root view controller (1) is a has a scroll view. In it is two view controllers (2 and 3), and they have further navigation deeper into the app. I want it to be able to make the edge swipe from left to navigate back. When I make the first view controller and "Embed in Navigation Controller" through the Interface Builder, it dosn't enable the back swipe.</p>
  
  <p>Maybe it's because I add view controller 2 and 3 to view controller 1 programmatically? But it dosn't work either if I embed view controller 3 in a navigation controller, eventhoug I have connected everything from there on via segues.</p>
  
  <p>View controller 1, 3 and 5 have scrollviews embedded, maybe the swipe functions of the scrollview overrides the swipe back function?</p>
  
  <p>The view controllers 2 and 3 are embedded in view controller 1 like this:</p>
  
  <pre><code>scrollView.addSubview(ViewControllerThree.view)
  </code></pre>
  
  <p>I havn't tried to make the navigation controller programmatically, if that posible.</p>
  
  <p>Any ideas?</p>
  
  <p><a href="https://i.stack.imgur.com/rIe0S.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rIe0S.png" alt="Overview of Storyboard"></a></p>
  
  <p><strong>EDIT</strong></p>
  
  <p>I've tried doing it programmatically like this:</p>
  
  <p>I add the following code to app delegate <code>application_didFinishLaunchingWithOptions</code>, and remove the navigation controller from my storyboard. But I have the same problem, it seems that when I seque away from view controller 2 or 3, I loose the navigation controller.</p>
  
  <pre><code>    var storyboard = UIStoryboard(name: "Main", bundle: nil)
      var viewController = storyboard.instantiateViewControllerWithIdentifier("New Landing Page")
      self.window = UIWindow(frame: UIScreen.mainScreen().bounds)
      var nav = UINavigationController(rootViewController: viewController)
      self.window?.rootViewController = nav;
      self.window?.makeKeyAndVisible();
  </code></pre>