title: iPhone UIView Animation Best Practice
body: <p>What is considered best practice for animating view transitions on the iPhone? </p>
  
  <p>For example, the <code>ViewTransitions</code> sample project from apple uses code like:</p>
  
  <pre><code>CATransition *applicationLoadViewIn = [CATransition animation];
  [applicationLoadViewIn setDuration:1];
  [applicationLoadViewIn setType:kCATransitionReveal];
  [applicationLoadViewIn setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn]];
  [[myview layer] addAnimation:applicationLoadViewIn forKey:kCATransitionReveal];
  </code></pre>
  
  <p>but there are also code snippets floating around the net that look like this: </p>
  
  <pre><code>[UIView beginAnimations:nil context:nil];
  [UIView setAnimationDuration:0.75];
  [UIView setAnimationDelegate:self];
  [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:myview cache:YES];
  [myview removeFromSuperview];
  [UIView commitAnimations];
  </code></pre>
  
  <p>What is the best approach? If you could provide a snippet as well it'd be much appreciated. </p>
  
  <p><strong>NOTE:</strong> I've been unable to get the second approach to work correctly. </p>