Contents

MKOverlay

An interface for associating content with a specific map region.

Declaration

protocol MKOverlay : MKAnnotation

Overview

Overlay objects are data objects that define the geographic data to cover. MapKit defines several concrete classes that adopt this protocol and define standard shapes like rectangles, circles, and polygons. You might use overlays to define the geographic boundaries of a national park or trace a bus route along city streets. You add an overlay to your map view by calling its addOverlay(_:) method or any other map view method for adding overlays to the map. When the overlay’s region intersects the visible portion of the map, the map view calls the mapView(_:rendererFor:) method of its delegate to obtain the renderer object responsible for drawing the overlay.

If you add an overlay to a map view as an annotation, instead of adding it as an overlay, the map view treats your overlay as an annotation. Specifically, it displays your overlay only when its coordinate is in the visible map region, rather than displaying the overlay when any portion of its covered area is visible.

Topics

Describing the overlay geometry

Determining map intersections

Optimizing map rendering

See Also

Shared behavior