title: Why does my navigation bar disappear from my split view when I rotate on iPhone 6+?
body: <p><strong>The Problem</strong></p>
  
  <p>I have a problem with my split view.  It works fine on iPhone and iPad simulators, but on the iPhone 6+ I lose the navigation bar after rotating the device.  Here's what happens on the 6+ simulator:</p>
  
  <ul>
  <li>I start the app and it presents a + button in the navigation bar.  I tap this button.</li>
  <li>It loads a view controller over the existing view.  A navigation bar, as expected, is visible with a working back button.</li>
  <li>I turn the device horizontally.  As intended the new controller appears in the Master section, with an empty detail section on the right. Unfortunately the navigation bar dissapears.</li>
  <li>When I turn the device vertically the navigation bar does not reappear.</li>
  </ul>
  
  <p>In fact when I turn the device horizontally it seems the navigation controller is removed from the stack (I've observed this from outputting the contents of splitViewContoller.viewControllers).</p>
  
  <p><strong>My Code</strong></p>
  
  <p>The test application is simply the Master Detail template with a few modifications.  </p>
  
  <p>I've added a new "Add Item" controller and then created a show segue from the Master view's "+" button.  The "Add Item" controller is blank, just a blue background.</p>
  
  <p>The DetailViewController has a timerStarted boolean value that is true when the detail view is being used and false when it isn't.  The master view is hidden when the detail is in use and displayed when it isn't.  </p>
  
  <p>Here's the relevant code (there's nothing interesting in AppDelegate as it's no longer a split view delegate, and MasterViewController has no interaction as the button works via the storyboard)</p>
  
  <p>DetailViewController</p>
  
  <pre><code>import UIKit
  
  class DetailViewController: UIViewController, UISplitViewControllerDelegate {
      @IBOutlet weak var detailDescriptionLabel: UILabel!
      var collapseDetailViewController = true
  
  
      var detailItem: AnyObject? {
          didSet {
              self.configureView()
          }
      }
  
      var timerStarted: Bool = false {
          didSet {
              self.changeTimerStatus()
          }
      }
  
      func configureView() {
          if let detail: AnyObject = self.detailItem {
              if let label = self.detailDescriptionLabel {
                  label.text = detail.description
                  self.timerStarted = true
              }
          }
      }
  
      func changeTimerStatus() {
          if self.timerStarted {
              if splitViewController!.collapsed == false {
                  UIView.animateWithDuration(0.3, animations: {
                      self.splitViewController?.preferredDisplayMode = UISplitViewControllerDisplayMode.PrimaryHidden
                  })
              }
              collapseDetailViewController = false
          } else {
              if splitViewController!.collapsed {
                  self.splitViewController?.viewControllers[0].popToRootViewControllerAnimated(true)
              } else {
                  UIView.animateWithDuration(0.3, animations: {
                      self.splitViewController?.preferredDisplayMode = UISplitViewControllerDisplayMode.AllVisible
                  })
              }
              collapseDetailViewController = true
          }
      }
  
      override func viewDidLoad() {
          super.viewDidLoad()
          splitViewController?.delegate = self
          self.disabledScreen.hidden = false
          self.view.bringSubviewToFront(disabledScreen)
          self.configureView()
      }
  
      override func viewWillAppear(animated: Bool) {
          if splitViewController!.collapsed == false &amp;&amp; self.timerStarted == false {
              splitViewController?.preferredDisplayMode = UISplitViewControllerDisplayMode.AllVisible
          }
      }
  
      @IBAction func closeButton(sender: AnyObject) {
          self.timerStarted = false
      }
  
      func primaryViewControllerForExpandingSplitViewController(splitViewController: UISplitViewController) -&gt; UIViewController? {
          if timerStarted == true {
              splitViewController.preferredDisplayMode = UISplitViewControllerDisplayMode.PrimaryHidden
          } else {
              splitViewController.preferredDisplayMode = UISplitViewControllerDisplayMode.AllVisible
          }
          return nil
      }
  
      func splitViewController(splitViewController: UISplitViewController, collapseSecondaryViewController secondaryViewController: UIViewController!, ontoPrimaryViewController primaryViewController: UIViewController!) -&gt; Bool {
          return collapseDetailViewController
      }
  }
  </code></pre>
  
  <p>AddItemViewController</p>
  
  <pre><code>import UIKit
  
  class AddItemViewController: UIViewController, UISplitViewControllerDelegate {
      var collapseDetailViewController = false
  
      override func viewDidLoad() {
          super.viewDidLoad()
          self.splitViewController?.delegate = self
      }
  
      override func didReceiveMemoryWarning() {
          super.didReceiveMemoryWarning()
      }
  
      override func viewDidAppear(animated: Bool) {
          self.splitViewController?.delegate = self
          self.collapseDetailViewController = false
      }
  
      override func viewWillDisappear(animated: Bool) {
          self.splitViewController?.delegate = nil
          self.collapseDetailViewController = true
      }
  
      func primaryViewControllerForExpandingSplitViewController(splitViewController: UISplitViewController) -&gt; UIViewController? {
          return self
      }
  
      func primaryViewControllerForCollapsingSplitViewController(splitViewController: UISplitViewController) -&gt; UIViewController? {
          return nil
      }
  
      func splitViewController(splitViewController: UISplitViewController, collapseSecondaryViewController secondaryViewController: UIViewController!, ontoPrimaryViewController primaryViewController: UIViewController!) -&gt; Bool {
          return collapseDetailViewController
      }
  }
  </code></pre>
  
  <p>I'd be grateful for any suggestions.</p>