You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.
I have just started using the latest released version of Mapbox for iOS, and have setup a map with annotations successfully. The annotations needed custom images based upon a priority value passed by the API. To do this I am using imageForAnnotation as follows:
- (MGLAnnotationImage *)mapView:(MGLMapView *)mapView imageForAnnotation:(id <MGLAnnotation>)annotation
{
CustomAnnotation *custom = (CustomAnnotation *)annotation;
NSString *name = nil;
if (custom.priority == 1 || custom.priority == 2)
name = @"dot_red";
else if (custom.priority == 3)
name = @"dot_orange";
else if (custom.priority > 3)
name = @"dot_yellow";
else if (custom.priority == -11)
name = @"dot_purple";
MGLAnnotationImage *annotationImage = [mapView dequeueReusableAnnotationImageWithIdentifier:name];
if ( ! annotationImage)
{
UIImage *annoImage = [UIImage imageNamed:name];
annotationImage = [MGLAnnotationImage annotationImageWithImage:annoImage reuseIdentifier:name];
}
return annotationImage;
}
However, when I change the map style all of the annotations disappear, the map change code is below:
Now when I pan around the map, I notice that the following pops up in the debug window '{Worker}[Sprite]: Can't find sprite named'. This is apparently an issue caused by the asynchronous loading (Source: #1877), however, the suggested workaround is to implement imageForAnnotation which I do anyway.
I have attached 3 screenshots below of me toggling the map type:
As you can see, even when toggling back to the original map again the images never re-appear. The annotations are definitely being added again (subsection of the broken in to imageForAnnotation po below):
po mapView.annotations
<__NSArrayI 0x7fc1b8dec650>(
<CustomAnnotation: 0x7fc1b8b4b450>,
<CustomAnnotation: 0x7fc1b3df6780>
)
Has anyone else come across this issue and know how to fix it? I am wondering whether the changing of map style re-orders the map layers, therefore annotations are drawn below the map tiles?
The text was updated successfully, but these errors were encountered:
I have just started using the latest released version of Mapbox for iOS, and have setup a map with annotations successfully. The annotations needed custom images based upon a priority value passed by the API. To do this I am using imageForAnnotation as follows:
However, when I change the map style all of the annotations disappear, the map change code is below:
Now when I pan around the map, I notice that the following pops up in the debug window '{Worker}[Sprite]: Can't find sprite named'. This is apparently an issue caused by the asynchronous loading (Source: #1877), however, the suggested workaround is to implement imageForAnnotation which I do anyway.
I have attached 3 screenshots below of me toggling the map type:
As you can see, even when toggling back to the original map again the images never re-appear. The annotations are definitely being added again (subsection of the broken in to imageForAnnotation po below):
Has anyone else come across this issue and know how to fix it? I am wondering whether the changing of map style re-orders the map layers, therefore annotations are drawn below the map tiles?
The text was updated successfully, but these errors were encountered: