Created
November 23, 2016 21:51
-
-
Save frosty/df91059dd36bcf609b0c3e59e0d4b96e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/WordPress/Classes/ViewRelated/System/WPSplitViewController.swift b/WordPress/Classes/ViewRelated/System/WPSplitViewController.swift | |
index 1ea4a35..03ec48c 100644 | |
--- a/WordPress/Classes/ViewRelated/System/WPSplitViewController.swift | |
+++ b/WordPress/Classes/ViewRelated/System/WPSplitViewController.swift | |
@@ -98,6 +98,14 @@ class WPSplitViewController: UISplitViewController { | |
return UITraitCollection(traitsFromCollections: [collection, overrideCollection]) | |
} | |
+ override func viewWillAppear(animated: Bool) { | |
+ super.viewWillAppear(animated) | |
+ | |
+ if viewControllers.count == 1 { | |
+ updateInitialViewControllers() | |
+ } | |
+ } | |
+ | |
override func viewWillTransitionToSize(size: CGSize, withTransitionCoordinator coordinator: UIViewControllerTransitionCoordinator) { | |
super.viewWillTransitionToSize(size, withTransitionCoordinator: coordinator) | |
@@ -222,18 +230,17 @@ class WPSplitViewController: UISplitViewController { | |
* detail view controller. | |
*/ | |
func setInitialPrimaryViewController(viewController: UIViewController) { | |
- var initialViewControllers = [viewController] | |
+ viewControllers = [viewController] | |
+ } | |
- if let navigationController = viewController as? UINavigationController, | |
+ func updateInitialViewControllers() { | |
+ if let navigationController = viewControllers.first as? UINavigationController, | |
let rootViewController = navigationController.viewControllers.last, | |
let detailViewController = initialDetailViewControllerForPrimaryViewController(rootViewController) { | |
navigationController.delegate = self | |
- initialViewControllers.append(detailViewController) | |
- viewControllers = initialViewControllers | |
- } else { | |
- viewControllers = [viewController, UIViewController()] | |
+ viewControllers = [navigationController, detailViewController] | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment