I’m reading Apple doc but I don’t understand what a root controller is. The doc says that this is the controller at the bottom of the stack. Maybe, is this the controller that I’ve push the first time? Anyone can explain this concept?
From Apple doc UINavigationController, I’ve seen that there is a method called initWithRootViewController
Initializes and returns a newly
created navigation controller.
– (id)initWithRootViewController:(UIViewController
*)rootViewController
What does it mean? Then, is it possible to change the root view controller or not?
Remember that
rootViewControllerisn’t a type of object, but a property name. It just happens to be the particularUIViewControllerinstance at the bottom of the stack, as Nubbel said.Methods like
initWithRootViewControllerare for situations when you want to initializeUINavigationController, and also tell it to “use this VC as the first VC in the heirarchy”.It seems like
UINavigationControllerreally doesn’t want you to change that property after it’s been created, but it looks like ppl have found ways to do it: – Remember to check the comments to see if this is an “approved” method of working.