iOS Developer Library

Developer

MapKit Framework Reference MKPinAnnotationView Class Reference

Options
Deployment Target:

On This Page
Language:

MKPinAnnotationView

The MKPinAnnotationView class provides a concrete annotation view that displays a pin icon like the ones found in the Maps application. Using this class, you can configure the type of pin to drop and whether you want the pin to be animated into place.

Inheritance


Import Statement


Swift

import MapKit

Objective-C

@import MapKit;

Availability


Available in iOS 3.0 and later.
  • pinColor pinColor Property

    The color of the pin head.

    Declaration

    Swift

    var pinColor: MKPinAnnotationColor

    Objective-C

    @property(nonatomic) MKPinAnnotationColor pinColor

    Discussion

    The Maps application uses different pin colors for different types of map annotations. Your own map annotation should use the available pin colors in the same way. For a description of when to use each type of pin, see the constants of “MKPinAnnotationColor”.

    Import Statement

    Objective-C

    @import MapKit;

    Swift

    import MapKit

    Availability

    Available in iOS 3.0 and later.

  • A Boolean value indicating whether the annotation view is animated onto the screen.

    Declaration

    Swift

    var animatesDrop: Bool

    Objective-C

    @property(nonatomic) BOOL animatesDrop

    Discussion

    When this property is YEStrue, the map view animates the appearance of pin annotation views by making them appear to drop onto the map at the target point. This animation occurs whenever the view transitions from offscreen to onscreen.

    Import Statement

    Objective-C

    @import MapKit;

    Swift

    import MapKit

    Availability

    Available in iOS 3.0 and later.

  • The supported colors for pin annotations.

    Declaration

    Swift

    enum MKPinAnnotationColor : UInt { case Red case Green case Purple }

    Objective-C

    enum { MKPinAnnotationColorRed = 0, MKPinAnnotationColorGreen, MKPinAnnotationColorPurple }; typedef NSUInteger MKPinAnnotationColor;

    Constants

    • Red

      MKPinAnnotationColorRed

      The head of the pin is red. Red pins indicate destination points on the map.

      Available in iOS 3.0 and later.

    • Green

      MKPinAnnotationColorGreen

      The head of the pin is green. Green pins indicate starting points on the map.

      Available in iOS 3.0 and later.

    • Purple

      MKPinAnnotationColorPurple

      The head of the pin is purple. Purple pins indicate user-specified points on the map.

      Available in iOS 3.0 and later.

    Import Statement

    Objective-C

    @import MapKit;

    Swift

    import MapKit

    Availability

    Available in iOS 3.0 and later.