# MGLAnnotationImage

    @interface MGLAnnotationImage : NSObject <NSSecureCoding>

The `MGLAnnotationImage` class is responsible for presenting point-based annotations visually on a map view. Annotation image objects wrap `UIImage` objects and may be recycled later and put into a reuse queue that is maintained by the map view.

#### Related examples

See the Mark a place on the map with an image example to learn how use an image as a marker using `MGLAnnotationImage`.

### Initializing and Preparing the Image Object

- `+annotationImageWithImage:reuseIdentifier:`

  Initializes and returns a new annotation image object.

  #### Declaration

  Objective-C

      + (nonnull instancetype)annotationImageWithImage:(nonnull UIImage *)image
                                       reuseIdentifier:
                                           (nonnull NSString *)reuseIdentifier;

  Swift

      convenience init(image: UIImage, reuseIdentifier: String)

  #### Parameters

  `image` | The image to be displayed for the annotation.
  `reuseIdentifier` | The string that identifies that this annotation image is reusable.

  #### Return Value

  The initialized annotation image object or `nil` if there was a problem initializing the object.

  View Source on GitHub

### Getting and Setting Attributes

- `image`

  The image to be displayed for the annotation.

  #### Declaration

  Objective-C

      @property (readwrite, strong, nonatomic, nullable) UIImage *image;

  Swift

      var image: UIImage? { get set }

  View Source on GitHub
- `reuseIdentifier`

  The string that identifies that this annotation image is reusable. (read-only)

  You specify the reuse identifier when you create the image object. You use this type later to retrieve an annotation image object that was created previously but which is currently unused because its annotation is not on screen.

  If you define distinctly different types of annotations (with distinctly different annotation images to go with them), you can differentiate between the annotation types by specifying different reuse identifiers for each one.

  #### Declaration

  Objective-C

      @property (readonly, nonatomic) NSString *_Nonnull reuseIdentifier;

  Swift

      var reuseIdentifier: String { get }

  View Source on GitHub
- `enabled`

  A Boolean value indicating whether the annotation is enabled.

  The default value of this property is `YES`. If the value of this property is `NO`, the annotation image ignores touch events and cannot be selected.

  #### Declaration

  Objective-C

      @property (getter=isEnabled, assign, readwrite, nonatomic) BOOL enabled;

  Swift

      var isEnabled: Bool { get set }

  View Source on GitHub