I think the answer to my question is “Yes”, but i just would like a confirmation from everyone.
I have a UITableView which should “slide” to another UIViewController when i select a row.
I’ve done this before with other apps (and they’ve included the UINavigationController, though in a UITabView).
So im wondering:
Is a UINavigationController required in order to use the self.navigationController pushViewController?
If so (which again i suspect to be true), where must I define the UINavigationController?
In the AppDelegate? In the main/primary UIViewController?
The short answer is: Yes.
UINavigationController was designed with the purpose of managing and animating a stack of view controllers on and off the screen (in conjunction with a few other interface elements such as a navigation bar, or a toolbar). Traditionally, UINavigationControllers are strongly held and initialized by the App Delegate, as they are considered a top-priority root object. An example class showing the proper usage of a
UINavigationControllermight look like this:The long answer, as always, is No.
UINavigationController can be trivially reimplemented (and it has, many times) to great effect. It’s as simple as subclassing UIViewController and bolting on some kind of stack (like an NSMutableArray).