title: Animation is slow on iPhone
body: <p>I'm developing an app that would display images and change them according to the user's action.  I've created a subclass of UIView to contain an image, an index number and an array of image names.  The code is like this:</p>
  
  <pre><code>@interface CustomPic : UIView {
      UIImageView *pic;
      NSInteger index;
      NSMutableArray *picNames;  //&lt;-- an array of NSString
  }
  </code></pre>
  
  <p>And in the implementation part, it has a method to change the image using a dissolve effect.</p>
  
  <pre><code>- (void)nextPic {
      index++;
      if (index &gt;= [picNames count]) {
      index = 0;
      }
      UIImageView *temp = pic;
      pic.image = [UIImage imageNamed:[picNames objectAtIndex:index]];
      temp.alpha = 0;
  
      [UIView beginAnimations:nil context:nil];
      [UIView setAnimationCurve:UIViewAnimationCurveEaseOut];
      [UIView setAnimationDuration:0.25];
      pic.alpha = 0;
      temp.alpha = 1;
      [UIView commitAnimations];
  }
  </code></pre>
  
  <p>In the viewController, there are several <code>CustomPic</code> which would change the images depends on users' choice.  The images would change as expected with the fade in/out effect, but the animation performance is really bad.  I've tested it on an iPhone 3G, the Instruments shows that the animation is only 2-3FPS!  I tried many methods to simplify and modify the codes but with no hope.  Is there something wrong in my code or in my concept?  Thanks for any help.</p>
  
  <p>P.S. all the images are 320*480 PNGs with a max size of 15KB.</p>