Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Allow annotation images to be updated #3146

Closed
wants to merge 3 commits into from

Conversation

RomainQuidet
Copy link
Contributor

Add possibility to delete / update a sprite in order to update an AnnotationImage
#2210

Fixes #2517

@incanus
Copy link
Contributor

incanus commented Nov 30, 2015

Thanks for this @RomainQuidet. May take a bit, but we will try to review this soon. It looks pretty clean.

/cc @kkaefer @jfirebaugh @1ec5

@@ -13,12 +13,12 @@ NS_ASSUME_NONNULL_BEGIN
* @param image The image to be displayed for the annotation.
* @param reuseIdentifier The string that identifies that this annotation image is reusable.
* @return The initialized annotation image object or `nil` if there was a problem initializing the object. */
+ (instancetype)annotationImageWithImage:(UIImage *)image reuseIdentifier:(NSString *)reuseIdentifier;
+ (instancetype)annotationImageWithImage:(UIImage *)image reuseIdentifier:(nullable NSString *)reuseIdentifier;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MGLMapView currently assumes that the reuse identifier is non-null. With a nil identifier, this line would crash. Is there a need for it to be nullable?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi,
That was a reminder to make it nullable as in the official MapKit. This identifier is used to recycle the instance for performance reason, it should not be used internally like today to reference the image view in a dictionary or even deeper with the sprites

@RomainQuidet
Copy link
Contributor Author

@1ec5 : do you need me to update the pull request or will you merge it ?

@1ec5
Copy link
Contributor

1ec5 commented Dec 14, 2015

Since we use fast-forward merging, it'd be cleaner for you to rebase and resolve the conflicts. I'd be happy to do it but I'd have to open a new PR and close this one.

@RomainQuidet
Copy link
Contributor Author

@1ec5 : branch rebased and corrections done according to your code review

@1ec5 1ec5 changed the title Issue 2210 Allow annotation images to be updated Dec 15, 2015
@1ec5
Copy link
Contributor

1ec5 commented Dec 16, 2015

Merged in 9d0ab55...82a5575. The test failure above is a random KIF failure, and Bitrise won’t let me rebuild the fork branch.

Thanks @RomainQuidet!

@alexagat
Copy link

When I update the image property on a MGLAnnotationImage, for example in the didSelectAnnotation function:

func mapView(mapView: MGLMapView, didSelectAnnotation annotation: MGLAnnotation) {
    annotationsTitlesAndImages[annotation.title!!]!.image = UIImage(named: "map-pin-active")!
}

...I see the below block of code in mapbox-gl framework run, but the annotation image does not update:

- (void)setImage:(UIImage *)image {
    _image = image;
    [self.delegate annotationImageNeedsRedisplay:self];
}

Is this still an issue?

@1ec5
Copy link
Contributor

1ec5 commented Mar 31, 2016

@alexagat, can you open a new issue about this? It sounds like a regression if that’s the case.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature iOS Mapbox Maps SDK for iOS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants