Mac Developer Library

Developer

MKMapSnapshot Class Reference

Options
Deployment Target:

On This Page
Language:

MKMapSnapshot

Inheritance


Conforms To


Import Statement


Swift

import MapKit

Objective-C

@import MapKit;

Availability


Available in OS X v10.9 and later.

An MKMapSnapshot object contains an image generated by a snapshotter object. You do not create instances of this class directly. Instead, you use an MKMapSnapshotter object capture the map contents asynchronously. Upon completion, the snapshotter object generates an image based on the options you provide and delivers that image inside an instance of this class.

Snapshot images do not include any custom overlays or annotations that your app added to the map view. If you want your annotations and overlays to appear on the final image, you must draw them yourself. To position those items correctly on the image, use the pointForCoordinate: method of this class to translate the overlay or annotation coordinate value to an appropriate location inside the image’s coordinate space.

  • image image Property

    The image of the map’s content. (read-only)

    Declaration

    Swift

    var image: NSImage! { get }

    Objective-C

    @property(nonatomic, readonly) NSImage *image

    Discussion

    The image object contains representations appropriate for display on both Retina and standard displays.

    Import Statement

    Objective-C

    @import MapKit;

    Swift

    import MapKit

    Availability

    Available in OS X v10.9 and later.

  • Converts the specified map coordinate to a point in the coordinate space of the image.

    Declaration

    Swift

    func pointForCoordinate(_ coordinate: CLLocationCoordinate2D) -> NSPoint

    Objective-C

    - (NSPoint)pointForCoordinate:(CLLocationCoordinate2D)coordinate

    Parameters

    coordinate

    A map coordinate that you want to convert.

    Return Value

    The point in the image’s coordinate space that corresponds to the map location.

    Discussion

    If you want to display additional views or content on top of the image, you can use this method to find an appropriate point at which to draw those items.

    Import Statement

    Objective-C

    @import MapKit;

    Swift

    import MapKit

    Availability

    Available in OS X v10.9 and later.