简体   繁体   English

如何在MapBox iOS SDK v2中将自定义动画图像显示为注释标记

[英]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? 我想问问是否有人知道如何使用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. 我曾尝试在Google Maps iOS SDK中使用[UIImage animatedImageNamed:]使用一系列图像,它似乎可以正常工作,但在MapBox iOS SDK v2中使用时似乎并非如此。

I have also tried the following code in MapBox iOS SDK v2 but with no luck: 我也在MapBox iOS SDK v2中尝试了以下代码,但是没有运气:

-(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 观看此空间: https : //github.com/mapbox/mapbox-gl-native/issues/1125

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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