Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I have been using the latter for a lot of nice lightweight animations. You can use it crossfade two views, or fade one in in front of another, or fade it out. You can shoot a view over another like a banner, you can make a view stretch or shrink... I'm getting a lot of mileage out of <code>beginAnimation</code>/<code>commitAnimations</code>.</p> <p>Don't think that all you can do is: </p> <pre><code>[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:myview cache:YES]; </code></pre> <p>Here is a sample:</p> <pre><code>[UIView beginAnimations:nil context:NULL]; { [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut]; [UIView setAnimationDuration:1.0]; [UIView setAnimationDelegate:self]; if (movingViewIn) { // after the animation is over, call afterAnimationProceedWithGame // to start the game [UIView setAnimationDidStopSelector:@selector(afterAnimationProceedWithGame)]; // [UIView setAnimationRepeatCount:5.0]; // don't forget you can repeat an animation // [UIView setAnimationDelay:0.50]; // [UIView setAnimationRepeatAutoreverses:YES]; gameView.alpha = 1.0; topGameView.alpha = 1.0; viewrect1.origin.y = selfrect.size.height - (viewrect1.size.height); viewrect2.origin.y = -20; topGameView.alpha = 1.0; } else { // call putBackStatusBar after animation to restore the state after this animation [UIView setAnimationDidStopSelector:@selector(putBackStatusBar)]; gameView.alpha = 0.0; topGameView.alpha = 0.0; } [gameView setFrame:viewrect1]; [topGameView setFrame:viewrect2]; } [UIView commitAnimations]; </code></pre> <p>As you can see, you can play with alpha, frames, and even sizes of a view. Play around. You may be surprised with its capabilities.</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