title: Core Animation problem on iPhone
body: <p>I'm new to iPhone development, and doing some experimentation with Core Animation. I've run into a small problem regarding the duration of the animation I'm attempting.</p>
  
  <p>Basically, Ive got a view with two subviews, and I'm trying to animate their opacity so that one fades in while the other fades out. Problem is, instead of a gradual fade in/out, the subviews simply switch instantly to/from full/zero opacity. I've tried to adjust the animation duration with CATransaction with no noticable effect. It's also not specific to animating opacity - animating position shows the same problem.</p>
  
  <p>The code I'm using (inside a method of the superview) follows:</p>
  
  <pre><code>CALayer* oldLayer = ((UIView*) [[self subviews] objectAtIndex:0]).layer;
  CALayer* newLayer = ((UIView*) [[self subviews] objectAtIndex:1]).layer;
  
  [CATransaction begin];
  [CATransaction setAnimationDuration:1.0f];
  oldLayer.opacity = 0.0;
  newLayer.opacity = 1.0;
  [CATransaction commit];
  </code></pre>
  
  <p>Does anyone have an idea what the problem might be?</p>