I have a split view controller that has a list of items on the left and a detail view on the right. Relevant code in AppDelegate:
let splitViewController = mainView.instantiateViewControllerWithIdentifier("initial") as! UISplitViewController
let rightNavController = splitViewController.viewControllers.last as! UINavigationController
let detailViewController = rightNavController.topViewController as! DetailsIpad
let leftNavController = splitViewController.viewControllers.first as! UINavigationController
let masterViewController = leftNavController.topViewController as! MainViewController
masterSplitViewController = masterViewController
detailSplitViewController = detailViewController
// Override point for customization after application launch.
let navigationController = splitViewController.viewControllers[splitViewController.viewControllers.count-1] as! UINavigationController
navigationController.topViewController!.navigationItem.leftBarButtonItem = splitViewController.displayModeButtonItem()
splitViewController.delegate = self
self.window!.rootViewController = splitViewController
When I first launch the app I see that the right part of the split screen takes up all of the screen:
If I rotate the screen, it becomes properly set (probably because both views are present on the screen):
When I set breakpoints everywhere, I see that the detail view on the right gets loaded before the master view on the left (list of items), despite not being called directly. I cannot change the order in which the views of the split screen are called. How can I fix this?
Aucun commentaire:
Enregistrer un commentaire