2017-07-19 50 views
0

我有一个自定义关闭动画,它使用UIPercentDrivenInteractiveTransitionUIViewControllerAnimatedTransitioning。它由一个放松的继续开始,转换的代表在prepareForSegue:中设置。确定何时展开静态动画完成

在我展示的视图控制器中,展开IBAction在我开始搜索时一直会被调用,而不是在完成搜索时。这是有问题的,因为我的解散动画是手势驱动的,所以我们不知道需要多长时间才能完成。

有没有办法知道赛格什么时候完成了它的动画?

viewWillAppear:也没有viewDidAppear:似乎在完成时被调用,我认为这是因为segue是一个unwind segue。

回答

0

捕捉动画完成后你可以使用这个。

- (void)perform { 
     [CATransaction begin]; 
     [[self sourceViewController] presentViewController:[self destinationViewController] animated:YES completion:nil]; 
     [CATransaction setCompletionBlock:^{ 
      //whatever you want to do after the animation 
     }]; 
     [CATransaction commit]; 
    }