Reputation: 2832
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.
Any ideas how I could solve this ? Or is it a bug of mapbox ?
Upvotes: 1
Views: 1325
Reputation: 5128
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.
Upvotes: 2