Graphics Programs Reference
In-Depth Information
UINavigationController
When your application presents multiple screens of information,
UINavigationCon-
troller
maintains a stack of those screens. Each screen is the
view
of a
UIViewCon-
troller
, and the stack is an array of view controllers. When a
UIViewController
is
on top of the stack, its
view
is visible.
When you initialize an instance of
UINavigationController
, you give it one
UIViewController
. This
UIViewController
is the navigation controller's
root
view controller
. The root view controller is always on the bottom of the stack. More view
controllers can be pushed on top of the
UINavigationController
's stack while the
application is running. This ability to add to the stack at runtime is missing from
UIT-
abBarController
, which gets all of its view controllers when it is initialized. With a
navigation controller, only the root view controller is guaranteed to always be in the stack.
When a
UIViewController
is pushed onto the stack, its
view
slides onto the screen
from the right. When the stack is popped, the top view controller is removed from the
stack, and the view of the one below it slides onto the screen from the left.
Figure 11.2
shows a navigation controller with two view controllers: a root view controller
and an additional view controller above it at the top of the stack. The
view
of the addition-
al view controller is what the user sees because that view controller is at the top of the
stack.
Figure 11.2 UINavigationController's stack