-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Replace MGLAnnotation image on didSelectAnnotation: #2210
Comments
This will rely on #1688. |
Refs #1980 |
May i know when can we expect this fix? |
@hshah2811 That (#1688) is of a class of bug/enhancement we are trying to get into this week's release, but it may not quite make it. Stay tuned — on a short timeline. |
I also looking forward to fix this bug/enhancement. Thank you. |
FYI I'm working on it. Will send a pull request soon |
Code is working, cleaning up and pull request coming soon |
Pull request sent : (#3146) |
Fixed by #3146. |
@RomainQuidet Could you give me an example how to change an image(MGLAnnotationImage) for selected annotation in didSelectAnnotation? I can't figure out ... |
@minikin : I'm doing this on my sample - (void)mapView:(MFMapView *)mapView didSelectAnnotation:(nonnull id<MGLAnnotation>)annotation
{
// set selected annotation image
MGLAnnotationImage *annoImage = [self.annotationImages objectForKey:annotation.title];
annoImage.image = [UIImage imageNamed:@"marker-green"];
} |
@RomainQuidet Thank you very much! I tried like that : I would appreciate any advice. Thanks. |
@minikin MGLAnnotationImages are objects in the mapBox SDK with a designated initializer |
@RomainQuidet Thank you.
I have an error :
ps: |
@1ec5 maybe you can help me? Thanks! |
@minikin, please contact our Support staff, and we’d be happy to assist you further. |
I am still facing an issue trying to change an annotation image on the fly (without removing and adding all annotations). I create a dictionary of annotation titles to annotations - I populate this dictionary with all my MGLAnnotationImages within the
I try and update the annotation's image in the
With a breakpoint set on the
...but the image doesn't update. Any insight? |
replacing the image property of annotationImage should do the job. But I've seen yesterday an error saying I'll check that. |
@alexagat Were you able to find a way to change image of an annotation? (without removing & adding) |
@alexagat @Ramshandilya, if setting the MGLAnnotationImage’s |
In Earlier Mapbox version 1.X, we do have RMMarker.replaceUIImage(Image) API to change the annotation image on marker/annotation selection.
But in new 2.0+ versions, i cann't see any API available on MGLAnnotation to replace the existing annotation image.
Requirement is: I want to change annotation/marker image when user taps/select on any annotation/marker in the map.
CODE:
Assigning non-selected image to all markers during map load.
Once user taps:
- (MGLAnnotiation*) mapView:(MGLMapView*)mapView didSelectAnnotation:(MGLAnnotation*)annotation { //No API to change image of selected annotation }
The text was updated successfully, but these errors were encountered: