我正在使用导航控制器,并且试图在新的视图控制器推送之前运行动画。为此,我从 UINavigationController 委托中捕获事件,并运行动画。也就是说,显然 iOS 动画是异步运行的,所以方法返回,我的动画与标准推送动画同时运行。关于如何解决这个问题的任何想法?
情况如下所示:
- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated
{
if (animated)
{
[UIView animateWithDuration:kGFDefaultAnimationDuration
delay:0.0
options:UIViewAnimationCurveEaseOut | UIViewAnimationOptionAllowUserInteraction
animations:^{
// Set up animations here...
}
completion:^(BOOL finished) {
}];
}
}
所以换句话说,我想navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated
从完成块中返回。