为什么这个简单的动画无法在iOS 7上运行?

use*_*ajo 7 animation objective-c uiviewanimation ios ios7

在我的项目中,我有一个简单的动画,我只是从左到右移动一个视图.这在iOS 6中运行良好,但是当我在iOS 7中运行它没有做任何事情.有人知道为什么吗?如果动画非常简单,我该如何修复iOS 7?我的代码是:

- (void) showAnimation
 {
    if (IS_IPAD())
    {
       [UIView animateWithDuration:50.0f 
                             delay:1
                           options:UIViewAnimationOptionRepeat
                        animations:^{
                                         ViewBOLIVIA.frame = CGRectMake(1024,0,  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,0,  ViewBOLIVIA.frame.size.width, ViewBOLIVIA.frame.size.height);
                                          } completion:nil];
        }
        else
        {
             [UIView animateWithDuration:50.0f 
                                   delay:1 
                                 options:UIViewAnimationOptionRepeat
                              animations:^{
                                               ViewBOLIVIA.frame = CGRectMake(480,0,  ViewBOLIVIA.frame.size.width, ViewBOLIVIA.frame.size.height);
                                          } completion:nil];
        }
    }
 }
Run Code Online (Sandbox Code Playgroud)

我做了更新,我使用Xcode 5和iOS 7所以任何帮助人,你知道如何解决这个问题吗?

jim*_*bob 16

好的,我想我已经解决了.在iOS 7之前,可以在带有故事板的viewDidLoad中运行动画.如果您将动画调用移动到- (void)viewDidAppear那时它们应该再次开始工作.所以你的情况,你会想调用[self showAnimation];- (void)viewDidAppear.

- (void)viewDidAppear{
   [self showAnimation];
}
Run Code Online (Sandbox Code Playgroud)