Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

present calloutView immediately after dismiss it with animation will cause error #51

Closed
Whirlwind opened this issue Aug 23, 2013 · 4 comments

Comments

@Whirlwind
Copy link

the code:

[calloutView dismissCalloutAnimated:YES];
[calloutView presentCalloutFromRect:rect inView:self constrainedToView:self permittedArrowDirections:SMCalloutArrowDirectionAny animated:YES];

I get dismiss animation, but the dismiss animation will not complete, and the present animation will start. After some seconds, I think that after dismiss animation's duration, the calloutView will remove from super view:

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

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

        [self removeFromParent]; // it will be remove, although I present it.
        [self.layer removeAnimationForKey:@"dismiss"];

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

How should I do for it?

@nfarina
Copy link
Owner

nfarina commented Aug 23, 2013

Why are you dismissing callout with animation then immediately presenting it? If you want to dismiss callout, wait until it's gone, then present it again, you might use the delegate method -calloutViewDidDisappear - wait until that's called, and then present the new callout.

@jlerner
Copy link

jlerner commented Oct 20, 2013

I think I ran into this issue as well, if I'm understanding Whirlwind correctly. If a callout is already showing, tapping to view another callout caused the first to disappear and the second to appear just for a moment. Fixed by setting delay to 0 in mapView:didDeselectAnnotationView:.

@Whirlwind
Copy link
Author

@jlerner , yeah you are right. I will test the method. Thanks.

@nfarina
Copy link
Owner

nfarina commented Feb 14, 2014

Hello, it's been a while so I'm closing this now. I've also verified myself that it's possible to dismiss a callout without animation then immediately re-present it with animation and it works OK, so I think that's the best way to go.

@nfarina nfarina closed this as completed Feb 14, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants