Instance Method

view(for:)

Returns the annotation view associated with the specified annotation object, if any.

Declaration

func view(for annotation: MKAnnotation) -> MKAnnotationView?

Parameters

annotation

The annotation object whose view you want.

Return Value

The annotation view or nil if the view has not yet been created. This method may also return nil if the annotation is not in the visible map region and therefore does not have an associated annotation view.

See Also

Creating Annotation Views

func register(AnyClass?, forAnnotationViewWithReuseIdentifier: String)

Registers an annotation view class that the map can create automatically.

func dequeueReusableAnnotationView(withIdentifier: String, for: MKAnnotation) -> MKAnnotationView

Returns a reusable annotation view using the specified identifier.

func dequeueReusableAnnotationView(withIdentifier: String) -> MKAnnotationView?

Returns a reusable annotation view located by its identifier.

let MKMapViewDefaultAnnotationViewReuseIdentifier: String

The default reuse identifier for your map's annotation views.

let MKMapViewDefaultClusterAnnotationViewReuseIdentifier: String

The default reuse identifier for the annotation view representing a cluster of annotations.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software