简体   繁体   中英

How to show custom animated images as annotation marker in MapBox iOS SDK v2

I would just like to ask if anyone has any idea how to implement animation of custom annotation marker image using MapBox iOS SDK v2? I have tried using series of images using [UIImage animatedImageNamed:] in Google Maps iOS SDK and it seems to work but it doesn't seem so when used in MapBox iOS SDK v2.

I have also tried the following code in MapBox iOS SDK v2 but with no luck:

-(MGLAnnotationImage *)mapView:(MGLMapView *)mapView imageForAnnotation:(id<MGLAnnotation>)annotation {
    MGLAnnotationImage *annotationImage = [mapView dequeueReusableAnnotationImageWithIdentifier:@"reuse_id"];

    if (!annotationImage)
    {
        UIImage *image = [UIImage animatedImageNamed:@"marker" duration:0.5f];
        annotationImage = [MGLAnnotationImage annotationImageWithImage:image reuseIdentifier:@"reuse_id"];
    }

    return annotationImage;
}

This isn't yet supported; only static images are. Watch this space: https://github.com/mapbox/mapbox-gl-native/issues/1125

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM