在我的项目中,我有一个简单的动画,我只是从左到右移动一个视图.这在iOS 6中运行良好,但是当我在iOS 7中运行它没有做任何事情.有人知道为什么吗?如果动画非常简单,我该如何修复iOS 7?我的代码是:
- (void) showAnimation
{
if (IS_IPAD())
{
[UIView animateWithDuration:50.0f
delay:1
options:UIViewAnimationoptionRepeat
animations:^{
ViewBOLIVIA.frame = CGRectMake(1024,ViewBOLIVIA.frame.size.width,ViewBOLIVIA.frame.size.height);
} completion:nil];
}
else
{
if (IS_IPHONE_5)
{
[UIView animateWithDuration:50.0f
delay:1
options:UIViewAnimationoptionRepeat
animations:^{
ViewBOLIVIA.frame = CGRectMake(568,ViewBOLIVIA.frame.size.height);
} completion:nil];
}
else
{
[UIView animateWithDuration:50.0f
delay:1
options:UIViewAnimationoptionRepeat
animations:^{
ViewBOLIVIA.frame = CGRectMake(480,ViewBOLIVIA.frame.size.height);
} completion:nil];
}
}
}
我做了更新,我使用Xcode 5和iOS 7所以任何帮助人,你知道如何解决这个问题吗?
解决方法
好的,我想我已经解决了.在iOS 7之前,可以在带有故事板的viewDidLoad中运行动画.如果将动画调用移动到 – (void)viewDidAppear,那么它们应该再次开始工作.所以在你的情况下你会想要调用[self showAnimation]; in – (void)viewDidAppear.
- (void)viewDidAppear{
[self showAnimation];
}