I'm trying to change the color of the user location, as it is done in the "find my friends" app by Apple (see attached screenshot).
Note that I'm using the MapBox SDK, and I currently have the following method:
- (RMMapLayer *)mapView:(RMMapView *)mapView layerForAnnotation:(RMAnnotation *)annotation
{
if (annotation.isUserLocationAnnotation)
return nil;
}
I also looked into this thread to have an idea about how I should do something similar, but didn't find the same code for user location. Did Apple use a static PNG picture for Find my friends? Will I lose the adaptive circle around the position by changing it to another color (if that's even possible)?
UPDATE
As @Incanus said in his reply, in my -[RMMapViewDelegate mapView:layerForAnnotation:]
callback method, I should get three calls corresponding to isUserLocationAnnotation = YES
-- the dot, the accuracy circle, and the pulsing halo.
I only get one, and I don't get why.
Also, I tried to customise the annotation when the tracking mode changes, here's what I did:
if (self.mMapView.userTrackingMode == RMUserTrackingModeNone)
{
for (RMAnnotation *annotation in self.mMapView.annotations) {
if (annotation.isUserLocationAnnotation) {
if ([annotation.annotationType isEqualToString:@"RMAccuracyCircleAnnotation"]) {
[(RMCircle*)annotation.layer setFillColor:[[UIColor redColor] colorWithAlphaComponent:0.6]];
[(RMCircle*)annotation.layer removeAllAnimations];
}
}
}
[self enableBouncingOnLayer:self.mMapView.userLocation.layer];
}
else
{
[self.mMapView.userLocation.layer removeAnimationForKey:@"animateScale"];
}
So far so good, I get the blue accuracy circle to turn red and stop changing size. The problem is, the MapBox framework will still update it, so it will go back to normal.
What's interesting is, using this method, I do have 3 annotation with isUserLocationAnnotation set to YES, but I only get one callback.
Any help appreciated.