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?

Shaik Riyaz
  • 11,204
  • 7
  • 53
  • 70
user_Dennis_Mostajo
  • 2,279
  • 4
  • 28
  • 38

2 Answers2

16

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];
}
Darshan Kunjadiya
  • 3,323
  • 1
  • 29
  • 31
jimbob
  • 3,288
  • 11
  • 45
  • 70
  • thanks jimbob but not work for me, I will continue trying to find a solution, I check with breakpoints and NSLogs, if call the method in viewDidLoad and viewdidapear, and runs but does not show, i don't know why? T_T – user_Dennis_Mostajo Sep 26 '13 at 13:21
  • have you tried using UIViewAnimationOptionBeginFromCurrentState? – jimbob Sep 26 '13 at 15:22
  • Sorry Dude, not working, & for the animation, I need UIViewAnimationOptionRepeat, because I need in a loop or infinite run animation meanwhile I use the app U_U – user_Dennis_Mostajo Sep 30 '13 at 23:08
0

I found placing the code in this method works.

-(void)viewDidAppear:(BOOL)animated {
    menuView.alpha = 0;
    topLabel.alpha = 0;
    [UIView animateWithDuration:1.5 animations:^{
       menuView.alpha = 1;
       topLabel.alpha = 1;
    }];
   [super viewDidAppear:animated];
 }
Matt Sarabyte
  • 245
  • 1
  • 3
  • 10