【发布时间】:2011-10-06 03:21:55
【问题描述】:
我有以下基于块的动画:
[UIView animateWithDuration:0.5f delay:0.0f
options:UIViewAnimationOptionRepeat|UIViewAnimationOptionAutoreverse|UIViewAnimationOptionAllowUserInteraction|UIViewAnimationOptionCurveEaseInOut
animations:^{
[view.layer setTransform:CATransform3DMakeScale(1.3f, 1.3f, 1.0f)];
NSLog(@"animating");
}completion:^(BOOL finished){
NSLog(@"Completed");
}];
当应用从后台返回时,将调用完成块,并且我的动画不会重新启动。我尝试使用以下委托方法重新启动动画:
- (void)applicationWillEnterForeground:(UIApplication *)application
{
/*
Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
*/
[[self viewController] animate];
......
}
但这并不能恢复动画。
同样,我尝试了这些问题的答案中列出的方法:
但是那里的建议都没有对我有用。当应用程序从后台返回时,还有其他方法可以恢复基于块的 UIView 动画吗?
【问题讨论】:
标签: ios cocoa-touch uiview core-animation