Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is this simple animation not working on iOS 7?

In my project I have a simple animation, I just move a view from left to right. This works fine in iOS 6, but when I run in iOS 7 it does not do anything. Does someone know why? If the animation is very simple how can I fix this for iOS 7? My code is:

- (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];
        }
    }
 }

I did update and Im using Xcode 5 and iOS 7 so any help guys, do you know how fix this?

like image 248
user_Dennis_Mostajo Avatar asked Sep 23 '13 20:09

user_Dennis_Mostajo


1 Answers

OK I think I resolved it. Before iOS 7 it was okay to have animations running in viewDidLoad with storyboards. If you move your animation calls to - (void)viewDidAppear then they should start working again. So in your case you will want to call [self showAnimation]; in - (void)viewDidAppear.

- (void)viewDidAppear{
   [self showAnimation];
}
like image 150
jimbob Avatar answered Oct 16 '22 17:10

jimbob