Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
5020
Interrupting showInView/dismiss
posted

I built an in-app notification class around the overlay that behaves like you'd expect in-app notifications to behave.  I can addNotification: with a duration/color/message, and each consecutive call will queue up notifications.  The problem is when I handle addNotification when the current overlay is animating out.  Instead of being able to "show" and move the overlay back in to view, it uses isVisible to just change the color/message... which is basically off screen.  What's the best way to handle interrupting this animation so I can have full control over these crucial inflection points?

Parents
  • 4940
    Verified Answer
    Offline posted

    Are you asking how would you handle a case where a notification is added when the IGOverlayView is currently animating out? If so, the IGOverlayView is the using animateWithDuration:delay:options:animations:completion: method from the UIView class and it would be best to wait until the animation is complete or use the custom animation enumerations when dismissing the overlay. When dismissing the overlay, use the animation IGOverlayAnimationCustomFade or IGOverlayAnimationCustomSlide to trigger the customExitAnimationForOverlay: delegate method being called. This works out the equivalent of chaining UIView animations. There are a few other options should this not fit what you're currently looking to do.

    If you would like more delegate methods added to further control the overlay showing and dismissing, detail your requirements at the NucliOS ideas page.

    Edit 1: In addition, to avoid changing the animations you may have chosen it is possible to use the overlayDismissed: method from IGOverlayViewDelegate to show the next notification.

    - (void)overlayDismissed:(IGOverlayView *)overlayView
    {
        // Check isVisible in a while loop by using a NSRunLoop to avoid blocking the UI thread
        while (overlayView.isVisible)
            [[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];

        [self show];
    }

Reply Children
No Data