How to Make the Map Title Your Found Location in Your iOS App - dummies

How to Make the Map Title Your Found Location in Your iOS App

By Neal Goldstein, Dave Wilson

How do you make the map title your found location in your iOS app? In the case of the FindController, use the text the user entered as the title, so all you do is override mapTitle. Add the code to FindController.m to display the title as the found location.

- (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 below.


If you wanted to, you could even create a tpedef 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 once.

This is how to create a typedef for a block that you could use in your own projects. Type the following code:

typedef void (^addLocationCompletionHandler)     (Annotation *annotation, NSError* error);

Add the instance variable as

addLocationCompletionHandler   addFindLocationCompletionHandler;

and then save the block in the new instance variable

addFindLocationCompletionHandler = completion;

and (finally) call the block in this way instead:

addFindLocationCompletionHandler(foundAnnotation, error);