2017-07-19 21 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]; 
    }