【问题标题】:Mapbox annotation layer rotation resets on map zoom or moveMapbox 注释层旋转在地图缩放或移动时重置
【发布时间】:2014-02-13 12:32:27
【问题描述】:

我正在尝试在 mapbox 中自定义注释图层的外观。 我想旋转每个注释层。

- (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;
}

它在他们第一次加载到地图上时起作用。但是当我移动或缩放地图时,它们会重置为初始变换单位矩阵。

有什么想法可以解决这个问题吗?还是mapbox的bug?

【问题讨论】:

    标签: ios annotations transform mapbox


    【解决方案1】:

    annotationTransform 中查看RMMapView.m。这会在罗盘跟踪模式等移动过程中得到纠正,因此您需要使用自己的自定义转换来修改内容,因为这不是此 SDK 的公共 API 部分。

    【讨论】:

    • 啊,谢谢!我做到了,它就像我现在需要的那样工作。顺便说一句,mapbox 讨论发生了什么?我不能再访问它了。
    猜你喜欢
    • 1970-01-01
    • 2023-01-20
    • 2023-03-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多