Stuttering Animation?


Just finishing up Chapter 16 and noticed some stuttering animations when running on my iOS 4.1 device (an iPhone4). The iPhone simulator does not show the problem.

The animation when navigating from ItemsView -> ItemDetail seems to stutter, but only when an item has a picture. Returning to the items list from a detail view is always smooth, picture or not.

Note that if I repeatedly navigate to the same item (with a picture), the transition animation stutters every time.

Any suggestions on how to track down the problem?

  • Xcode 4.0, Build 4A153
  • iOS Device SDK 4.1
  • iPhone 4 with iOS 4.1 (8B117)



The problem is that the images from the camera on the iPhone 4 are absolutely gigantic. Even though a shrunk-down version is being displayed, it still has to load and process all of the pixels in the huge version.

The fix for this is to scale the image when you get it back from the camera to something more screen-sized. This fix will be in the 2nd edition of the book. You can shrink the image the same way you did for creating the thumbnail. Sounds like a good challenge.




Load the image and put it in the image view in viewDidAppear: instead viewWillAppear: to accomplish this.