I’ve read this chapter in the book - confused about a couple things:
- I have the book on Kindle, viewing on my Mac, and don’t see any page numbers, so I can’t give the exact location here.
In the chapter, it says:
No reason is given for this. Is this because we’re not subclassing UINavigationController, and can’t implement the UIViewControllerRestoration protocol? So we rely on the AppDelegate to do this?
- It’s not clear to me how child view controllers are handled. (I’m not using storyboards either).
The navigation controller the first time around in AppDelegate is initialized with the itemsViewController:
But then in the AppDelegate, for the restoration, you have:
- (UIViewController *)application:(UIApplication *)application
// Create a new navigation controller
UIViewController *vc = [[UINavigationController alloc] init];
So how does it know to set the root view controller to itemsViewController? It just seems weird that you call plain init here and then things happen behind the scenes that you have no control over.
Also, what about a more complex case, like a tabbed controller or some other controller that has say:
In the restoration, do you just ignore this initWithController1:Controller2:Controller3 and just go with init, and then just expect things to work with all the child controllers assigned correctly, assuming they have their own restoration set up properly?
Is there any way to get pointers to these restored child controllers and then call the proper initWithController1:Controller2:Controller3 in the parent class when restoring?
Thanks for any help.