Graphics Programs Reference
In-Depth Information
Taking pictures and UIImagePickerController
Now you need a button to initiate the photo-taking process. It would be nice to put this
button on the navigation bar, but we will need the navigation bar for another button later.
Instead, we will create an instance of
UIToolbar
and place it at the bottom of
De-
tailViewController
's
view
. In
DetailViewController.xib
, drag a
UIToolbar
onto the bottom of the
view
.
A
UIToolbar
works a lot like a
UINavigationBar
- you can add
UIBarBut-
tonItem
s to it. However, where a navigation bar has two slots for bar button items, a
toolbar has an array of bar button items. You can place as many
UIBarButtonItem
s in
a toolbar as can fit on the screen.
By default, a new instance of
UIToolbar
created in a XIB file comes with one
UIBarButtonItem
. Select this bar button item and open the attribute inspector.
Change the
Identifier
to
Camera
, and the item will show a camera icon (
Figure 12.4
).
Figure 12.4 UIToolbar with bar button item