<!--
{
  "availability" : [
    "iOS: 3.0.0 -",
    "iPadOS: 3.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/MKAnnotationView",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "MapKit"
    ],
    "preciseIdentifier" : "c:objc(cs)MKAnnotationView"
  },
  "title" : "MKAnnotationView"
}
-->

# MKAnnotationView

The visual representation of one of your annotation objects.

```
class MKAnnotationView
```

## Overview

*Annotation views* are loosely coupled to a corresponding *annotation object*, which is an object that conforms to the [`MKAnnotation`](/documentation/MapKit/MKAnnotation) protocol. When an annotation’s coordinate point is in the map’s visible region, the map view asks its delegate to provide a corresponding annotation view. MapKit may recycle annotation views and put them into a reuse queue that the map view maintains.

The most efficient way to provide the content for an annotation view is to set its [`image`](/documentation/MapKit/MKAnnotationView/image) property. The annotation view sizes itself automatically to the image you specify and draws that image for its contents. Because it’s a view, you can also override the <doc://com.apple.documentation/documentation/UIKit/UIView/draw(_:)> method and draw your view’s content manually. If you choose to override <doc://com.apple.documentation/documentation/UIKit/UIView/draw(_:)> directly and you don’t specify a custom image in the [`image`](/documentation/MapKit/MKAnnotationView/image) property, the annotation view sets the width and height of the annotation view’s frame to `0` by default. Before the framework can draw your custom content, you need to set the width and height to nonzero values by modifying the view’s <doc://com.apple.documentation/documentation/UIKit/UIView/frame> property. In general, if your content consists entirely of static images, it’s more efficient to set the [`image`](/documentation/MapKit/MKAnnotationView/image) property and change it as necessary than to draw the images yourself.

Annotation views anchor to the map at the point that their associated annotation object specifies. Although they scroll with the map contents, annotation views reside in a separate display layer and don’t scale when the size of the visible map region changes.

Additionally, annotation views support the concept of a *selection state*, which determines whether the map displays the annotation view as unselected, selected, or selected and displaying a standard callout view. The user toggles between the selection states through interactions with the annotation view. In the unselected state, the map displays the annotation view, but doesn’t highlight it. In the selected state, the framework highlights the annotation, but doesn’t display the callout. Finally, the map view can display the annotation with both a highlight and a callout. The callout view displays additional information, such as a title string and controls for viewing more information. The annotation object provides the title information, but your annotation view is responsible for providing any custom controls. For more information, see the [`Subclassing notes`](/documentation/MapKit/MKAnnotationView#Subclassing-notes) section below.

### Reuse annotation views

The design of annotation views enables their reuse as the user (or your app) changes the visible map region. The reuse of annotation views provides significant performance improvements during scrolling by avoiding the creation of new view objects during this time-critical operation. For this reason, don’t tightly couple annotation views to the contents of their associated annotation. Instead, use the properties of an annotation view (or setter methods) to configure the view for a new annotation object.

Whenever you initialize a new annotation view, specify a reuse identifier for that view. When the framework no longer needs annotation views, the map view may put them into a reuse queue. As the framework adds new annotations to the map view, the delegate object can then dequeue and reconfigure an existing view (rather than create a new one) using the [`dequeueReusableAnnotationView(withIdentifier:)`](/documentation/MapKit/MKMapView/dequeueReusableAnnotationView(withIdentifier:)) method of [`MKMapView`](/documentation/MapKit/MKMapView).

### Subclassing notes

You can use the `MKAnnotationView` class as-is or subclass it to provide custom behavior as necessary. The [`image`](/documentation/MapKit/MKAnnotationView/image) property of the class lets you set the appearance of the annotation view without subclassing directly. You might also create custom subclasses as a convenience and use them to put the annotation view in a known state.

There are no special requirements for subclassing `MKAnnotationView`. However, the following list includes some reasons you might want to subclass, and the methods to override to implement the desired behavior:

- To put the annotation view into a consistent state, provide a custom initialization method. Your custom initialization method then calls [`init(annotation:reuseIdentifier:)`](/documentation/MapKit/MKAnnotationView/init(annotation:reuseIdentifier:)) to initialize the superclass.
- To provide custom callout views, override the [`leftCalloutAccessoryView`](/documentation/MapKit/MKAnnotationView/leftCalloutAccessoryView) method and use it to return the views.

If you support draggable annotation views in iOS, your subclass is responsible for changing the value in the [`dragState`](/documentation/MapKit/MKAnnotationView/dragState-swift.property) property to appropriate values at key transition points in the drag operation. For more information, see the description of that property.

## Topics

### Creating and preparing an annotation view

[`-  initWithAnnotation:reuseIdentifier:`](/documentation/MapKit/MKAnnotationView/init(annotation:reuseIdentifier:))

Creates and returns a new annotation view.

[`-  initWithCoder:`](/documentation/MapKit/MKAnnotationView/init(coder:))

Creates an annotation view using data from the specified unarchiver.

[`-  prepareForReuse`](/documentation/MapKit/MKAnnotationView/prepareForReuse())

Calls this method when removing the view from the reuse queue.

[`-  prepareForDisplay`](/documentation/MapKit/MKAnnotationView/prepareForDisplay())

Notifies the annotation view that the map view is about to display it.

### Setting the priority for display

[`displayPriority`](/documentation/MapKit/MKAnnotationView/displayPriority)

The display priority of the annotation view.

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

Constants that indicates the display priority for annotations.

[`zPriority`](/documentation/MapKit/MKAnnotationView/zPriority)

The relative importance of the annotation view when in an unselected state with respect to its ordering along the z-axis.

[`selectedZPriority`](/documentation/MapKit/MKAnnotationView/selectedZPriority)

The relative importance of the annotation view when in a selected state with respect to its ordering along the z-axis.

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

Constants that indicates the priority for ordering overlapping annotation views.

### Getting and setting attributes

[`enabled`](/documentation/MapKit/MKAnnotationView/isEnabled)

A Boolean value that indicates whether the annotation is in an enabled state.

[`image`](/documentation/MapKit/MKAnnotationView/image)

The image the annotation view displays.

[`highlighted`](/documentation/MapKit/MKAnnotationView/isHighlighted)

A Boolean value that indicates whether the map view highlights the annotation view.

[`annotation`](/documentation/MapKit/MKAnnotationView/annotation)

The annotation object associated with the view.

[`centerOffset`](/documentation/MapKit/MKAnnotationView/centerOffset)

The offset (in points) at which to display the view.

[`calloutOffset`](/documentation/MapKit/MKAnnotationView/calloutOffset)

The offset (in points) at which to place the callout.

[`reuseIdentifier`](/documentation/MapKit/MKAnnotationView/reuseIdentifier)

The string that identifies that the annotation view is reusable.

### Managing the selection state

[`-  setSelected:animated:`](/documentation/MapKit/MKAnnotationView/setSelected(_:animated:))

Sets the selection state of the annotation view.

[`selected`](/documentation/MapKit/MKAnnotationView/isSelected)

A Boolean value that indicates whether the annotation view is in a selected state.

### Managing callout views

[`accessoryOffset`](/documentation/MapKit/MKAnnotationView/accessoryOffset)

An offset that changes the accessory’s default anchor point.

[`canShowCallout`](/documentation/MapKit/MKAnnotationView/canShowCallout)

A Boolean value that indicates whether the annotation view is able to display extra information in a callout.

[`leftCalloutAccessoryView`](/documentation/MapKit/MKAnnotationView/leftCalloutAccessoryView)

The view to display on the left side of the standard callout.

[`rightCalloutAccessoryView`](/documentation/MapKit/MKAnnotationView/rightCalloutAccessoryView)

The view to display on the right side of the standard callout.

[`detailCalloutAccessoryView`](/documentation/MapKit/MKAnnotationView/detailCalloutAccessoryView)

The detail accessory view to use in the standard callout.

[`leftCalloutOffset`](/documentation/MapKit/MKAnnotationView/leftCalloutOffset)

The offset in points from the middle-left of the annotation view.

[`rightCalloutOffset`](/documentation/MapKit/MKAnnotationView/rightCalloutOffset)

The offset in points from the middle-right of the annotation view.

### Supporting drag operations

[`draggable`](/documentation/MapKit/MKAnnotationView/isDraggable)

A Boolean value that indicates whether the annotation view is draggable.

[`-  setDragState:animated:`](/documentation/MapKit/MKAnnotationView/setDragState(_:animated:))

Sets the drag state for the annotation view.

[`dragState`](/documentation/MapKit/MKAnnotationView/dragState-swift.property)

The drag state of the annotation view.

### Managing collisions between annotation views

[`collisionMode`](/documentation/MapKit/MKAnnotationView/collisionMode-swift.property)

The collision mode to use when interpreting the collision frame rectangle.

[`CollisionMode`](/documentation/MapKit/MKAnnotationView/CollisionMode-swift.enum)

Constants that indicates how to interpret the collision frame rectangle of an annotation view.

### Clustering annotation views

[Decluttering a Map with MapKit Annotation Clustering](/documentation/MapKit/decluttering-a-map-with-mapkit-annotation-clustering)

Enhance the readability of a map by replacing overlapping annotations with a clustering annotation view.

[`clusteringIdentifier`](/documentation/MapKit/MKAnnotationView/clusteringIdentifier)

An identifier that determines whether the annotation view participates in clustering.

[`clusterAnnotationView`](/documentation/MapKit/MKAnnotationView/cluster)

The clustering annotation view that replaces the annotation view.

### Constants

[`DragState`](/documentation/MapKit/MKAnnotationView/DragState-swift.enum)

Constants that indicate the drag state of an annotation view.

### Notifications

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

A property to observe to determine when the title or subtitle information of an annotation object changes.

## Relationships

### Conforms To

[`NSUserActivityRestoring`](/documentation/AppKit/NSUserActivityRestoring)

[`NSAppearanceCustomization`](/documentation/AppKit/NSAppearanceCustomization)

[`CLBodyIdentifiable`](/documentation/CoreLocation/CLBodyIdentifiable)

[`UILargeContentViewerItem`](/documentation/UIKit/UILargeContentViewerItem)

[`UIPopoverPresentationControllerSourceItem`](/documentation/UIKit/UIPopoverPresentationControllerSourceItem)

[`NSAccessibilityProtocol`](/documentation/AppKit/NSAccessibilityProtocol)

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

[`UIDynamicItem`](/documentation/UIKit/UIDynamicItem)

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

[`UITraitChangeObservable-67e94`](/documentation/UIKit/UITraitChangeObservable-67e94)

[`UIAccessibilityIdentification`](/documentation/UIKit/UIAccessibilityIdentification)

[`UIResponderStandardEditActions`](/documentation/UIKit/UIResponderStandardEditActions)

[`CALayerDelegate`](/documentation/QuartzCore/CALayerDelegate)

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

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

[`UIFocusItem`](/documentation/UIKit/UIFocusItem)

[`NSCoding`](/documentation/Foundation/NSCoding)

[`UIAppearance`](/documentation/UIKit/UIAppearance)

[`UIFocusEnvironment`](/documentation/UIKit/UIFocusEnvironment)

[`NSStandardKeyBindingResponding`](/documentation/AppKit/NSStandardKeyBindingResponding)

[`UIActivityItemsConfigurationProviding`](/documentation/UIKit/UIActivityItemsConfigurationProviding)

[`NSUserInterfaceItemIdentification`](/documentation/AppKit/NSUserInterfaceItemIdentification)

[`UIPasteConfigurationSupporting`](/documentation/UIKit/UIPasteConfigurationSupporting)

[`CMBodyIdentifiable`](/documentation/CoreMotion/CMBodyIdentifiable)

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

[`UICoordinateSpace`](/documentation/UIKit/UICoordinateSpace)

[`UIUserActivityRestoring`](/documentation/UIKit/UIUserActivityRestoring)

[`NSTouchBarProvider`](/documentation/AppKit/NSTouchBarProvider)

[`NSDraggingDestination`](/documentation/AppKit/NSDraggingDestination)

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

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

[`UITraitEnvironment`](/documentation/UIKit/UITraitEnvironment)

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

[`NSAccessibilityElementProtocol`](/documentation/AppKit/NSAccessibilityElementProtocol)

[`NSAnimatablePropertyContainer`](/documentation/AppKit/NSAnimatablePropertyContainer)

[`UIFocusItemContainer`](/documentation/UIKit/UIFocusItemContainer)

[`UIAppearanceContainer`](/documentation/UIKit/UIAppearanceContainer)

### Inherited By

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

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

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

### Inherits From

[`NSView`](/documentation/AppKit/NSView)

[`UIView`](/documentation/UIKit/UIView)

---

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)