calloutview icon indicating copy to clipboard operation
calloutview copied to clipboard

animationDidStop delegate callback checks for finished

Open cooksimo opened this issue 8 years ago • 3 comments

- (void)animationDidStop:(CAAnimation *)anim finished:(BOOL)finished {
    BOOL presenting = [[anim valueForKey:@"presenting"] boolValue];

    if (presenting && finished) {
        if ([_delegate respondsToSelector:@selector(calloutViewDidAppear:)])
            [_delegate calloutViewDidAppear:(id)self];
    }
    else if (!presenting && finished) {

        [self removeFromParent];
        [self.layer removeAnimationForKey:@"dismiss"];

        if ([_delegate respondsToSelector:@selector(calloutViewDidDisappear:)])
            [_delegate calloutViewDidDisappear:(id)self];
    }
}

This delegate callback checks for finished, I don't think it should. Our use case is we are changing the callout visible on the map when the map isn't the frontmost view on the screen, when this happens iOS is optimizing the animation and calling this delegate with finished NO. This means the previous callout is never removed from the parent and will intercept any subsequent touches.

cooksimo avatar May 13 '16 05:05 cooksimo

I just ran into the same issue on an iPad, with a modal view controller on top of the map. Also, but perhaps unrelated, the callout takes a very long time (>1sec) to be presented after a modal view controller was shown.

davidganster avatar May 17 '16 15:05 davidganster

So this flag was added in aca4f1a to fix issue #64. Is there a simple solution that would resolve both issues?

nfarina avatar May 17 '16 20:05 nfarina

Not sure what the actual issue is in #64 - we've been running without the check for finished for a while now and haven't had any issues.

cooksimo avatar Aug 31 '16 00:08 cooksimo