我有一个使用UIPercentDrivenInteractiveTransition
和UIViewControllerAnimatedTransitioning
的自定义解雇动画。它由展开segue启动,转换委托在prepareForSegue:
中设置。
在我的呈现视图控制器中,展开IBAction会在我开始segue时立即调用,而不是在segue完成时调用。这是有问题的,因为我的解雇动画是手势驱动的,所以我们不知道需要多长时间才能完成。
有没有办法知道segue何时完成动画?
viewWillAppear:
和viewDidAppear:
似乎都没有在完成时被调用,我认为这是因为segue是一个展开的segue。
答案 0 :(得分: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];
}
答案 1 :(得分:0)
这在UIStoryboardSegue.h中进行了解释:
if (request()->has('image')) {
$postall = $user->posts()->with('comments', 'tags')->whereIn('privacy', [1, 2])->where('type', '=', 4)->where('status', 1)->where('archived', 0)->latest()
->paginate(15)->appends('image', request('image'));
} elseif (request()->has('video')) {
$postall = $user->posts()->with('comments', 'tags')->whereIn('privacy', [1, 2])->where('type', '=', 5)->where('status', 1)->where('archived', 0)->latest()
->paginate(15)->appends('video', request('video'));
} elseif (request()->has('audio')) {
$postall = $user->posts()->with('comments', 'tags')->whereIn('privacy', [1, 2])->where('type', '=', 6)->where('status', 1)->where('archived', 0)->latest()
->paginate(15)->appends('audio', request('audio'));
} elseif (request()->has('text')) {
$postall = $user->posts()->with('comments', 'tags')->whereIn('privacy', [1, 2])->whereIn('type', [1, 2, 3, 8])->where('status', 1)->where('archived', 0)->latest()
->paginate(15)->appends('text', request('text'));
} else {
$postall = $user->posts()->with('comments', 'tags')->whereIn('posts.privacy', [1, 2])->where('posts.type', '!=', 7)->where('posts.status', 1)->where('posts.archived', 0)->latest()->paginate(15);
}
例如
/// 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;