Graphics Programs Reference
In-Depth Information
UINavigationBar
The
UINavigationBar
isn't very interesting right now. A
UINavigationBar
should display a descriptive title for the
UIViewController
that is currently on top of
the
UINavigationController
's stack.
Every
UIViewController
has a
navigationItem
property of type
UINaviga-
tionItem
. However, unlike
UINavigationBar
,
UINavigationItem
is not a sub-
class of
UIView
, so it cannot appear on the screen. Instead, the navigation item supplies
the navigation bar with the content it needs to draw. When a
UIViewController
comes
to the top of a
UINavigationController
's stack, the
UINavigationBar
uses the
Figure 11.13 UINavigationItem
By default, a
UINavigationItem
is empty. At the most basic level, a
UINaviga-
tionItem
has a simple
title
string. When a
UIViewController
is moved to the
top of the navigation stack and its
navigationItem
has a valid string for its
title
property, the navigation bar will display that string (
Figure 11.14
)
.
Figure 11.14 UINavigationItem with title