Ios 确定展开序列动画何时完成
我有一个自定义动画,它使用Ios 确定展开序列动画何时完成,ios,objective-c,uistoryboardsegue,unwind-segue,Ios,Objective C,Uistoryboardsegue,Unwind Segue,我有一个自定义动画,它使用uipercentdriventeractivetransition和UIViewControllerAnimatedTransitioning。它由展开序列启动,并在prepareforsgue:中设置转换委托 在我的演示视图控制器中,只要我开始segue,就会不断调用unwind IBAction,而不是segue完成时。这是有问题的,因为我的动画是手势驱动的,所以我们不知道需要多长时间才能完成 有没有办法知道segue什么时候完成了动画 无论是视图都不会出现:还是
uipercentdriventeractivetransition
和UIViewControllerAnimatedTransitioning
。它由展开序列启动,并在prepareforsgue:
中设置转换委托
在我的演示视图控制器中,只要我开始segue,就会不断调用unwind IBAction,而不是segue完成时。这是有问题的,因为我的动画是手势驱动的,所以我们不知道需要多长时间才能完成
有没有办法知道segue什么时候完成了动画
无论是
视图都不会出现:
还是视图都不会出现:
似乎在完成时被调用,我假设这是因为该段是一个展开段。完成后捕捉动画您可以使用此功能
- (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];
}
捕捉动画完成后,可以使用此选项
- (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];
}
这在UIStoryboardSegue.h中进行了解释:
/// Subclasses can override this method to augment or replace the effect of this segue. For example, to animate alongside the effect of a Modal Presentation segue, an override of this method can call super, then send -animateAlongsideTransition:completion: to the transitionCoordinator of the destinationViewController.
/// The segue runtime will call +[UIView setAnimationsAreEnabled:] prior to invoking this method, based on the value of the Animates checkbox in the Properties Inspector for the segue.
- (void)perform;
e、 g
-(无效)执行{
[self.destinationViewController.transitionCoordinator AnimateLongSideTransition:^(id_非空上下文){
}完成:^(id_非空上下文){
//展开分段动画已完成
}];
[超级表演];
}
这在UIStoryboardSegue.h中有解释:
/// Subclasses can override this method to augment or replace the effect of this segue. For example, to animate alongside the effect of a Modal Presentation segue, an override of this method can call super, then send -animateAlongsideTransition:completion: to the transitionCoordinator of the destinationViewController.
/// The segue runtime will call +[UIView setAnimationsAreEnabled:] prior to invoking this method, based on the value of the Animates checkbox in the Properties Inspector for the segue.
- (void)perform;
e、 g
-(无效)执行{
[self.destinationViewController.transitionCoordinator AnimateLongSideTransition:^(id_非空上下文){
}完成:^(id_非空上下文){
//展开分段动画已完成
}];
[超级表演];
}