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.
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
MKAnnotationprotocol. This object manages the annotation data, such as
Annotation view: This is any object derived from
MKAnnotationView, which manages the drawing of the visual representation of the annotation object on the map.