Mapbox标注层旋转复位地图缩放或移动 [英] Mapbox annotation layer rotation resets on map zoom or move
问题描述
我想定制我的mapbox注释的层的外观。
我想每一个旋转标注层。
I'm trying to customize the appearance of the layers of my annotations in mapbox. I want to rotate every annotation layer.
- (RMMapLayer *)mapView:(RMMapView *)mapView layerForAnnotation:(RMAnnotation *)annotation
{
if (annotation.isUserLocationAnnotation)
return nil;
RMMarker *marker;
CGPoint xy = CGPointFromString(annotation.userInfo);
marker = [[RMMarker alloc] initWithUIImage:[UIImage imageNamed:@"arrow.png"]];
marker.transform = CATransform3DMakeRotation(atan2f(xy.x, xy.y) * 180 / M_PI,0,0,1);
marker.canShowCallout = YES;
return marker;
}
它的工作原理他们第一次在地图上加载。但是,当我移动或缩小它们重置回其初始地图变换矩阵。
It works the first time they load on the map. But when I move or zoom the map they reset back to their initial transform identity matrix.
任何想法我怎么能解决这个问题?抑或是mapbox的一个bug?
Any ideas how I could solve this ? Or is it a bug of mapbox ?
推荐答案
以在在 RMMapView.m
看看 annotationTransform
。这得到的东西像罗盘追踪模式在运动过程中纠正,所以你要修改的东西用自己的自定义转换(S),因为这不是这个SDK的公共API的一部分。
Take a look in RMMapView.m
at the annotationTransform
. This gets corrected during movements for things like compass tracking mode, so you'll want to modify things with your own custom transform(s) as this isn't a public API part of this SDK.
这篇关于Mapbox标注层旋转复位地图缩放或移动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!