<!--
{
  "availability" : [
    "iOS: 7.0.0 -",
    "iPadOS: 7.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.9.0 -",
    "tvOS: 9.2.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "MapKit",
  "identifier" : "/documentation/MapKit/MKOverlayRenderer",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "MapKit"
    ],
    "preciseIdentifier" : "c:objc(cs)MKOverlayRenderer"
  },
  "title" : "MKOverlayRenderer"
}
-->

# MKOverlayRenderer

The shared infrastructure for drawing overlays on the map surface.

```
class MKOverlayRenderer
```

## Overview

An overlay renderer draws the visual representation of an overlay object — that is, an object that conforms to the [`MKOverlay`](/documentation/MapKit/MKOverlay) protocol. This class defines the drawing infrastructure the map view uses. Subclasses need to override the [`draw(_:zoomScale:in:)`](/documentation/MapKit/MKOverlayRenderer/draw(_:zoomScale:in:)) method to draw the contents of the overlay.

The MapKit framework provides several concrete instances of overlay renderers. Specifically, it provides renderers for each of the concrete overlay objects. You can use one of these existing renderers or define your own subclasses if you want to draw the overlay contents differently.

You can subclass `MKOverlayRenderer` to create overlays based on custom shapes, content, or drawing techniques. The only method subclasses need to override is the [`draw(_:zoomScale:in:)`](/documentation/MapKit/MKOverlayRenderer/draw(_:zoomScale:in:)) method. However, if your class contains content that may not be ready for drawing right away, you need to also override the [`canDraw(_:zoomScale:)`](/documentation/MapKit/MKOverlayRenderer/canDraw(_:zoomScale:)) method and use it to report when your class is ready and able to draw.

The map view may tile large overlays and distribute the rendering of each tile to separate threads. Therefore, the implementation of your [`draw(_:zoomScale:in:)`](/documentation/MapKit/MKOverlayRenderer/draw(_:zoomScale:in:)) method needs to be safe to run from background threads and from multiple threads simultaneously.

## Topics

### Creating an overlay view

[`-  initWithOverlay:`](/documentation/MapKit/MKOverlayRenderer/init(overlay:))

Creates and returns the overlay renderer and associates it with the specified overlay object.

### Attributes of the overlay

[`overlay`](/documentation/MapKit/MKOverlayRenderer/overlay)

The overlay object containing the data for drawing.

[`alpha`](/documentation/MapKit/MKOverlayRenderer/alpha)

The amount of transparency to apply to the overlay.

[`contentScaleFactor`](/documentation/MapKit/MKOverlayRenderer/contentScaleFactor)

The scale factor for drawing the overlay’s content.

[`blendMode`](/documentation/MapKit/MKOverlayRenderer/blendMode)

The blend mode to apply to the overlay.

### Converting points on the map

[`-  pointForMapPoint:`](/documentation/MapKit/MKOverlayRenderer/point(for:))

Returns the point in the overlay renderer’s drawing area corresponding to the specified point on the map.

[`-  mapPointForPoint:`](/documentation/MapKit/MKOverlayRenderer/mapPoint(for:))

Returns the point on the map that corresponds to the specified point in the overlay renderer’s drawing area.

[`-  rectForMapRect:`](/documentation/MapKit/MKOverlayRenderer/rect(for:))

Returns the rectangle in the overlay renderer’s drawing area corresponding to the specified rectangle on the map.

[`-  mapRectForRect:`](/documentation/MapKit/MKOverlayRenderer/mapRect(for:))

Returns the rectangle on the map that corresponds to the specified rectangle in the overlay renderer’s drawing area.

### Drawing the overlay

[`-  canDrawMapRect:zoomScale:`](/documentation/MapKit/MKOverlayRenderer/canDraw(_:zoomScale:))

Returns a Boolean value that indicates whether the overlay view is ready to draw its content.

[`-  drawMapRect:zoomScale:inContext:`](/documentation/MapKit/MKOverlayRenderer/draw(_:zoomScale:in:))

Draws the overlay’s contents at the specified location on the map.

[`-  setNeedsDisplay`](/documentation/MapKit/MKOverlayRenderer/setNeedsDisplay())

Invalidates the entire contents of the overlay for all zoom scales.

[`-  setNeedsDisplayInMapRect:`](/documentation/MapKit/MKOverlayRenderer/setNeedsDisplay(_:))

Invalidates the specified portion of the overlay at all zoom scales.

[`-  setNeedsDisplayInMapRect:zoomScale:`](/documentation/MapKit/MKOverlayRenderer/setNeedsDisplay(_:zoomScale:))

Invalidates the specified portion of the overlay, but only at the specified zoom scale.

### Types

[`MKZoomScale`](/documentation/MapKit/MKZoomScale)

A scale factor to use in conjunction with a map.

[`MKRoadWidthAtZoomScale`](/documentation/MapKit/MKRoadWidthAtZoomScale(_:))

Returns the width (in screen points) of roads on a map at the specified zoom level.

## Relationships

### Conforms To

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

[`Hashable`](/documentation/Swift/Hashable)

[`Equatable`](/documentation/Swift/Equatable)

[`CVarArg`](/documentation/Swift/CVarArg)

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

### Inherited By

[`MKTileOverlayRenderer`](/documentation/MapKit/MKTileOverlayRenderer)

[`MKOverlayPathRenderer`](/documentation/MapKit/MKOverlayPathRenderer)

### Inherits From

[`NSObject-swift.class`](/documentation/ObjectiveC/NSObject-swift.class)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)