iOS 7 custom transition glitch

前端 未结 4 1042
孤街浪徒
孤街浪徒 2021-02-08 18:24

This video shows the issue I am having. http://www.youtube.com/watch?v=C9od_2KZAbs

I am attempting to create a custom push interactive transition using a UIPanGestureRec

相关标签:
4条回答
  • 2021-02-08 18:58

    As of iOS 7.1, I can reproduce this in simulator but not on an actual device. Anyway, there appears to be a workaround:

    self.interactiveTransitionAnimator.completionSpeed = 0.999;
    

    There is a radar for this bug: rdar://14675246

    0 讨论(0)
  • 2021-02-08 19:09

    I've got an example on github that works without the glitch. Let me know if you have further questions.

    0 讨论(0)
  • 2021-02-08 19:13

    What happens if you call the [transitionContext completeTransition:YES]; immediately after calling finishInteractiveTransition like this:

    else if (gestureRecogznier.state == UIGestureRecognizerStateEnded) {
    
        if ([gestureRecogznier velocityInView:self.view].x < 0) {
            [self.interactiveTransitionAnimator finishInteractiveTransition];
            [transitionContext completeTransition:YES];
        } else {
            [self.interactiveTransitionAnimator cancelInteractiveTransition];
        }
    
        self.interactiveTransitionAnimator = nil;
    }
    
    0 讨论(0)
  • Or, as matt observed here, you can also either defer the completeTransition or drive the custom interaction controller yourself:

    I've seen something similar. I have two possible workarounds. One is to use delayed performance in the animation completion handler:

       } completion:^(BOOL finished) {
                double delayInSeconds = 0.1;
                dispatch_time_t popTime = 
                     dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC));
                dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
                    BOOL cancelled = [transitionContext transitionWasCancelled];
                    [transitionContext completeTransition:!cancelled];
                });
               self.interacting = NO;
        }];
    

    The other possibility is: don't use percent-drive animation! I've never had a problem like this when driving the interactive custom animation myself manually.

    0 讨论(0)
提交回复
热议问题