From the course: iOS Development Tips

Unlock this course with a free trial

Join today to access over 22,600 courses taught by industry experts.

Tapping a map

Tapping a map

- [Instructor] Most map applications let you select a point on a map. However, touching a map, usually, is only for moving a map around. You might want to get a coordinate at a user's tap. In this tip, I'll show you how to get the coordinate, and place a marker there. Download the starter file, and you'll find an application for displaying a map of Twin Rivers, Wisconsin. This is one of three contenders. The others being Evanston, Illinois, and Ithaca, New York, for the first ice cream sundae. Run the code, and you get a map. Stop the app. There's a few steps for converting a touch into a coordinate. First you need tap. And react to the tap. Second, you get the coordinate of the tap, and the system of the view. Finally, you get a map coordinate that corresponds to the view's coordinate. To get the touch, use a tap gesture recognizer. Go to the story board. And type gesture into the filter. You'll see several gestures. Some of these are continuous, like pinches, and some like the tap…

Contents