O'Reilly logo

iOS Programming Cookbook by Hossam Ghareeb

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Displaying pins in map view

Pins (or annotations) are used to display markers on the map for specific locations, nearby places, or points of interest to the user. Each annotation represents a single point (coordinate) on the map which the user can select to get more information about the location. Annotations have another advantage, which is that they remain fixed on the map while the user scrolls or zooms the map; in that case, the annotation will move appropriately.

Getting ready

Before displaying annotations on the map, we need to highlight some points related to annotations and how they work. To display an annotation on the map, you need two separate things:

  • Annotation object: An annotation object is any object that conforms to MKAnnotation

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required