Initializing the Destination Class
Now it’s time to turn to the
Destination class and its initialization. Add the bolded code in Listing 11-4 to
Destination.h to update its interface to add the header files, the properties you’ll be using, and the method declarations.
Listing 11-4: Updating the Destination Interface
@interface Destination : NSObject
@property (nonatomic, readwrite)
@property (nonatomic, readwrite, copy) NSString *title;
@property (nonatomic, readwrite, copy) NSString *subtitle;
@property (nonatomic, strong) NSString *destinationName;
@property (nonatomic, strong) UIImage *destinationImage;
As you saw in Chapter 4, you’ll be displaying the destination on a map with an annotation (that pop-up window that displays information about the location when you touch the pin on the map). Doing that requires that the class adopt the
MKAnnotation protocol, which requires a
coordinate property of type
CLLocationCoordinate2d (that’s why you need to include the
CoreLocation frameworks) and optional
subtitle properties. Although you won’t be doing anything with this part of
Destination until Chapter 17, I have you initialize
Destination with what is described in the plist but defer the explanation until Chapter 17.
Next you need to add the
synthesize statements for the ...