Contents

addOverlay(_:)

Adds a single overlay object to the map.

Declaration

func addOverlay(_ overlay: any MKOverlay)

Parameters

  • overlay:

    The overlay object to add. This object needs to conform to the Mkoverlay protocol.

Discussion

The map view adds the specified object to the group of overlay objects in the MKOverlayLevel.aboveLabels level. Adding an overlay causes the map view to begin monitoring the area that the overlay represents. As soon as the bounding rectangle of an overlay intersects the visible portion of the map, the map view adds a corresponding overlay view to the map. Implement the mapView(_:rendererFor:) method of the map view’s delegate object to provide the overlay view.

To remove an overlay from a map, use the removeOverlay(_:) method.

See Also

Related Documentation

Adding and inserting overlays