在这篇文章中作者说我们可以在切换标签后重新启动动画viewWillAppear。
我打电话给我,startAnimation但仍然失败。viewWillAppearviewDidAppear
以下是我的代码的一部分。
- (void)startAnimation {
[UIView setAnimationsEnabled:YES];
[UIView animateWithDuration:0.5f
delay:0.0f
options:UIViewAnimationOptionAutoreverse|UIViewAnimationOptionRepeat
animations:^(void){
self.foreground.transform = CGAffineTransformMakeTranslation(0.0f, 5.0f);
}
completion:nil];
}
startAnimation动画在第一次调用in时效果很好viewDidLoad,但在切换到其他选项卡后它就不再起作用了。
应用程序从后台重新启动后它也不起作用,即使我已经注册了UIApplicationWillEnterForegroundNotificationfor的观察者startAnimation。
请帮助我,我是iOS开发的新手,非常感谢。