Note that there are some explanatory texts on larger screens.

plurals
  1. POAnimation doesn't start without view update
    text
    copied!<p><a href="https://github.com/SoundBlaster/ImageAnimationIssue" rel="nofollow">Sample on GitHub</a></p> <p>I have a strange problem.</p> <p>I have Navigation-based app with two UIViewControllers and Curl effect for transition between these.</p> <p>I add to bar button and add custom action: </p> <pre><code>-(IBAction)pushPage { NSLog(@"push page"); SecondViewController *secondView = [[SecondViewController alloc] initWithNibName:@"SecondViewController" bundle:nil]; [UIView beginAnimations:@"animation" context:nil]; [UIView setAnimationDuration:0.75]; [UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:self.navigationController.view cache:NO]; [self.navigationController pushViewController:secondView animated:NO]; [UIView commitAnimations]; [secondView release]; } </code></pre> <p>In SecondView I have a button with action:</p> <pre><code>-(IBAction)back { [imageAnimationIssueAppDelegate backPage]; } </code></pre> <p>Method <code>backPage</code> in AppDelegate:</p> <pre><code>-(void)backPage { NSLog(@"backPage"); [UIView beginAnimations:@"animation" context:nil]; [UIView setAnimationDuration:0.75]; [UIView setAnimationTransition:UIViewAnimationTransitionCurlDown forView:self.navigationController.view cache:NO]; [self.navigationController popToRootViewControllerAnimated:NO]; [UIView commitAnimations]; } </code></pre> <p>PROBLEM: On the RootView I have <code>UIImageView</code> with animation:</p> <pre><code>- (void)viewDidLoad { [super viewDidLoad]; animImage.animationImages = [NSArray arrayWithObjects: [UIImage imageNamed:@"1.png"], [UIImage imageNamed:@"2.png"], [UIImage imageNamed:@"3.png"], [UIImage imageNamed:@"4.png"], [UIImage imageNamed:@"3.png"], [UIImage imageNamed:@"2.png"], nil]; animImage.animationDuration = 0.5; animImage.animationRepeatCount = 0; } </code></pre> <p>I start it in <code>viewDidAppear</code>:</p> <pre><code>- (void)viewDidAppear:(BOOL)animated { NSLog(@"First view - viewDidAppear"); [super viewDidAppear:animated]; [animImage startAnimating]; } </code></pre> <p>I stop it in <code>viewDidDisapear</code>:</p> <pre><code>- (void)viewDidDisappear:(BOOL)animated { NSLog(@"First view - viewDidDisappear"); [super viewDidDisappear:animated]; [animImage stopAnimating]; } </code></pre> <p>When I back from SecondView animation is stoped! But <code>[animImage isAnimating]</code> say <code>YES</code>! It doesn't start witout update screen - you can click to button on the bottom and see it!</p> <p><strong>Is it bug?</strong></p> <p>Animation works without custom transitions.</p> <p>When I set <code>animated:YES</code> for push or pop view, animation works with custom transitions between views.</p> <p><strong>Why?</strong> Is there simple way to update displaying view to start animation?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload