我有一个简单的代码:
[otherClass doMethodOneWhichHasAnimation];
并且该动画持续 0.8 秒。后面是推送 View Controller 的代码:
SchemeView *schemeView = [[SchemeView alloc] init];
[self.navigationController pushViewController:schemeView animated:YES];
[schemeView release];
问题是,它没有等待就推送 View Controller ,而我希望它等待。做延迟只会延迟整个事情,包括开始的第一个动画。
如何让它在运行第二段代码之前等待 0.8 秒?
最佳答案
动画结束后可以push
[UIView animateWithDuration:0.8
animations:^{
// Animation
}
completion:^(BOOL finished){
// PushView
}];
< iOS 4+ 看看 setAnimationDidStopSelector
或
[self performSelector:@selector(metohodToPushView) withObject:nil afterDelay:0.8];
关于iphone - 我如何等到另一个类中的动画完成后再继续?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6330050/