UIPercentDrivenInteractiveTransition yielding extraneous animation when done

浪子不回头ぞ 提交于 2019-12-03 01:33:57

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.

This problem arises only in simulator.

SOLUTION: self.interactiveAnimator.completionSpeed = 0.999;

bug reported here: http://openradar.appspot.com/14675246

The reason for this error in my case was setting the frame of the view being animated multiple times. I'm only setting the view frame ONCE and it fixed my issues.

So in this case, the frame of "toViewController.view" was set TWICE, thus making the animation have an unwanted behavior

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!