iPad: Configuring the split-view controller should happen in init(), not loadView()

This commit is contained in:
Roopesh Chander 2018-11-07 15:54:30 +05:30
parent f8f19ef3d7
commit 1bba1ffe16
1 changed files with 9 additions and 4 deletions

View File

@ -6,18 +6,23 @@ import UIKit
class MainViewController: UISplitViewController {
var tunnelsListVC: TunnelsListTableViewController?
override func loadView() {
init() {
let detailVC = UIViewController()
detailVC.view.backgroundColor = UIColor.white
let detailNC = UINavigationController(rootViewController: detailVC)
let masterVC = TunnelsListTableViewController()
let masterNC = UINavigationController(rootViewController: masterVC)
self.tunnelsListVC = masterVC
super.init(nibName: nil, bundle: nil)
self.viewControllers = [ masterNC, detailNC ]
}
super.loadView()
tunnelsListVC = masterVC
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override func viewDidLoad() {