Making the Map Title the Found Location

In Chapter 17, I show you how to add the map title to the toolbar. In that discussion I add a method named mapTitle, which in the case of the MapController, sends a message to the Trip object to get the map’s title. In the case of the FindController, I want to use the text the user entered as the title, so all I do is override mapTitle. Add the code in Listing 19-11 to FindController.m to display the title as the found location.

Listing 19-11: Override mapTitle

- (NSString *)mapTitle {

return self.findLocation;

}

If you build and run RoadTrip, and enter Radio City Music Hall in the Find: field in the Master view and tap the annotation, you should see the screen displayed in Figure 19-7. (Notice I did not go down the road of displaying the Destination and the Point of Interest annotations, but even if you did, you’d still see the Radio City Music Hall annotation.)

Figure 19-7: Skippy loves the Rockettes.

9781118231333-fg1907.eps

technicalstuff.eps If you wanted to, you could even create a typedef for the addLocation: completionHandler:. The purpose of typedef is to assign another name to a type whose declaration is unwieldy. You’d want to use a typedef if you were going to have to type: void (^foundLocationCompletionHandler) (Annotation *annotation, NSError* error); more than ...

Get iPad Application Development For Dummies, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.