Chapter 1. A User Interface for Adding Hotels and Using the Address Book
In This Chapter
Creating a user interface to add a hotel
Accessing the Address Book to use exiting information
Adding a hotel address to the Address Book
Although the ability to add hotels that you want to stay in is obviously important (staying in the hard-coded default hotel San Francisco is a bit awkward if you're in Needles, California, for example), it's also really helpful to integrate your Address Book with your application to avoid the annoying "double" entry.
In this chapter, I show you how to create a view that allows the user to both enter a hotel as well as add that hotel to his or her Address Book. I also show you how to take a hotel already in the Address Book and add it as a hotel in the RoadTrip application.
Being able to do that becomes even more important when you realize that, even though the title of the view says "Hotels," a hotel can really be any place you're planning to stay. This includes the couch at your best friend's former girl- or boyfriend's cousin's.
Add AddHotelController
As you might expect, the first thing you need to do is add a view controller to manage the data entry view, like so:
In the RoadTrip project window, select the Classes folder and then choose File

In the left column of the dialog, select Cocoa Touch Classes under the iPhone OS heading, select the
UIViewControllersubclass ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access