Note that there are some explanatory texts on larger screens.

plurals
  1. POUIView Animations stop working after dismiss Modal View
    text
    copied!<p>I just upgraded my iPhone 4 from iOS 4.2.1 to 4.3.2, and to XCode 4.0.2, and I am encountering some bizarre issues with uiview animations. When I first launch my app, code like this executes perfectly: </p> <pre><code> [UIView beginAnimations:@"fadeAlphaIn" context:nil]; [UIView setAnimationDuration:0.5f]; viewClue.alpha = 1.0f; [UIView commitAnimations]; </code></pre> <p>But then, after dismissing a presenting and then dismissing a modal view by the standard method:</p> <pre><code>[self presentModalViewController:more animated:YES]; </code></pre> <p>and</p> <pre><code>[self dismissModalViewControllerAnimated:YES]; </code></pre> <p>the first animation no longer works. Instead of fading in, for example, the viewClue view simply jumps from alpha = 0 to alpha = 1. Similarly, other animations altering other views' frame property just force the frame to jump from the initial to final value without animation. These animations worked fine before the modal view was presented and dismissed.</p> <p>I understand that others have experienced animation issues with the upgrade to iOS 4.3.2, but the way the modal view disrupts animation seems very odd. Has anyone else experienced this problem? Any ideas as to a solution? I'm thinking of just adding the modal view as a subview and animation it as it hides and appears, but using the standard modal view method would be much preferred.</p> <p>Thanks for your help,</p> <p>James</p> <p>EDIT: Some more code showing how the app's map is animated</p> <pre><code>-(void) viewMapfunc { AudioServicesPlaySystemSound(soundID); if(mapvisible){ [UIView animateWithDuration:0.5 delay:0.1 options:UIViewAnimationOptionAllowUserInteraction animations:^{ map.frame = CGRectMake(0, 350, 320, 27); mapscroll.frame = CGRectMake(0, 27, 320, 0); } completion:nil]; mapvisible = NO; viewMapLabel.text = @"View Map"; }else { [UIView animateWithDuration:0.5 delay:0.1 options:UIViewAnimationOptionAllowUserInteraction animations:^{ map.frame = CGRectMake(0, 50, 320, 300); mapscroll.frame = CGRectMake(0, 27, 320, 300); } completion:nil]; mapvisible = YES; viewMapLabel.text = @"Hide Map"; } } </code></pre>
 

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