Datasheet
Book VII
Chapter 1
A User Interface
for Adding Hotels
and Using the
Address Book
763
Entering and Saving the Hotel Information
Figure 1-14:
Select and
paste.
Adding Cancel and Save buttons
Now you need to add two buttons: one to save any changes, and one to
enable you to cancel any changes you’ve made.
To add the buttons, you need to decide how to deal with a save or a cancel.
As I indicated earlier, the preferred method is to have the controller that
presented the view controller modally become a delegate of the modal view
controller and implement a method that will dismiss it (and do whatever
else needs to be done) when the modal view controller is done doing its
thing (that is, save or cancel).
Before you do that, though, I’d like you to add the buttons. You’ll do that in
the viewDidLoad method of the AddHotelController.
Add the viewDidLoad method to the AddHotelController by adding the
code in Listing 1-10 to AddHotelController.h.
41_542934-bk07ch01.indd 76341_542934-bk07ch01.indd 763 3/26/10 10:32 PM3/26/10 10:32 PM