SPAnnotationView

@interface SPAnnotationView

Extends MGLAnnotationView. Used as the default view for displaying point annotations on a map. Provides async image loading for marker icons.

  • Provides way to change the color of the annotation view background.

    Declaration

    Objective-C

    @property (nonatomic, strong) UIColor* annotationColor

    Swift

    var annotationColor: UnsafeMutablePointer<Int32>! { get set }
  • Change annotation type. Annotation types are drawn with different

    Declaration

    Objective-C

    - (void)setAnnotationType:(SPAnnotationType)type;

    Swift

    func setAnnotationType(_ type: Any!)

    Parameters

    type

    annotation type

  • Declaration

    Objective-C

    - (SPAnnotationType)annotationType;

    Swift

    func annotationType() -> Any!

    Return Value

    annotation type

  • Recommended constructor for SPAnnotationView objects. Allows the scaling of annotations, default scaling for annotations is 1.0.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithReuseIdentifier:
                                (nonnull NSString *)reuseIdentifier
                                              scale:(CGFloat)scale
                                               type:(SPAnnotationType)type;

    Swift

    init!(reuseIdentifier: Any!, scale: Any!, type: Any!)

    Parameters

    reuseIdentifier

    identifier for re-use

    scale

    scale for annotation view

    type

    annotation type

  • Replaces contents of the annotation view with an image. You can use this to override default annotation view visuals.

    Declaration

    Objective-C

    - (void)setImage:(id)image;

    Swift

    func setImage(_ image: Any!)

    Parameters

    image

    that will be displayed

  • Plays an animation.

    Declaration

    Objective-C

    - (void)animate:(SPAnnotationViewAnimation)animation
         completion:(nullable void (^)(BOOL))completionBlock;

    Swift

    func animate(_ animation: Any!, completion completionBlock: ((Int32) -> Void)? = nil)

    Parameters

    animation

    animation type

    completionBlock

    called when animation finishes

  • Clears all annotation images stored in memory cache. The SDK will clear the cache automatically and most of the time you do not need to call this method.

    Declaration

    Objective-C

    + (void)clearImageCache;

    Swift

    class func clearImageCache()