diff options
| author | Andrej Mihajlov <and@mullvad.net> | 2020-02-26 12:40:19 +0100 |
|---|---|---|
| committer | Andrej Mihajlov <and@mullvad.net> | 2020-02-26 17:14:56 +0100 |
| commit | 8c412d321da87873dbae6f77229f10685e59ebd4 (patch) | |
| tree | 0ff114c907013fb4e2b8970734075cf7c2c26b5b | |
| parent | 8922808f55a8458a1e7acd80959f84ce7a54bfe5 (diff) | |
| download | mullvadvpn-8c412d321da87873dbae6f77229f10685e59ebd4.tar.xz mullvadvpn-8c412d321da87873dbae6f77229f10685e59ebd4.zip | |
Make sure to add the child view controller before loading the view so that the `parent` is set when `viewDidLoad` is called
| -rw-r--r-- | ios/MullvadVPN/RootContainerViewController.swift | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/ios/MullvadVPN/RootContainerViewController.swift b/ios/MullvadVPN/RootContainerViewController.swift index 786b705dc8..f73d4f9778 100644 --- a/ios/MullvadVPN/RootContainerViewController.swift +++ b/ios/MullvadVPN/RootContainerViewController.swift @@ -173,13 +173,6 @@ class RootContainerViewController: UIViewController { self.updateHeaderBarStyleFromChildPreferences(animated: shouldAnimate) } - // Make sure that all new view controllers have loaded their views - // This is important because the unwind segue calls the unwind action which may rely on - // IB outlets to be set at that time. - for newViewController in newViewControllers { - newViewController.loadViewIfNeeded() - } - // Add new child controllers. The call to addChild() automatically calls child.willMove() // Children have to be registered in the container for Storyboard unwind segues to function // properly, however the child controller views don't have to be added immediately, and @@ -188,6 +181,13 @@ class RootContainerViewController: UIViewController { addChild(child) } + // Make sure that all new view controllers have loaded their views + // This is important because the unwind segue calls the unwind action which may rely on + // IB outlets to be set at that time. + for newViewController in newViewControllers { + newViewController.loadViewIfNeeded() + } + // Add the destination view into the view hierarchy if let targetView = targetViewController?.view { addChildView(targetView) |
