我正在使用 Carto-Mobile,并且尝试使用 CLLocation
true hedding 来旋转位置标记,但我无法使其工作。
我为位置标记设置了一个位图图像,它是一个 NTPoint
对象,但是 NTPoint
没有任何根据角度旋转的方法,而不是 NTMarker
,我尝试使用 NTMarker
作为位置标记,但在低缩放级别(缩放 6)时永远不会显示真实位置,因此 NTPoint
是更好的选择适合。
所以我希望任何人都可以告诉我如何使用 CARTO-SDK 使用 CLLocation
true hedding 来旋转位置标记
问候
最佳答案
以下代码应该可以工作并将图像保持在精确位置:
NTMarkerStyleBuilder *builder = [[NTMarkerStyleBuilder alloc]init];
// anchor 0,0 means that image is rotated from the center
// you may have different anchor point depending on graphics
[builder setAnchorPointX:0 anchorPointY:0];
self.positionMarker = [[NTMarker alloc] initWithPos:position style:[builder buildStyle]];
...
// rotate marker, depending on marker graphics
// "180-course" is ok if it is "arrow down"
// additional adjustment is for mapView rotation, image keeps
// here correct course even if map is rotated
double course = location.course;
[self.positionMarker setRotation: 180 - course - self.contentView.mapView.getRotation];
关于ios - 如何使用carto-mobile(CARTO-SDK)在ios中旋转位置标记,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46757053/