views:

160

answers:

3

I have an iPhone app that displays a modal view controller. The modal view controller shows two instances of a custom subclass of UITextView called RoundedTextView, an MKMapView, and a UIToolbar. I construct the viewController only once, and reset its data and present it each time the user summons it.

When showing this view controller with presentModalViewController, I noticed that the animation to show the view was choppy on the 3G. So, to speed it up, I set the alpha of the MKMapView and the two RoundedTextView objects to 0 on viewWillDisappear and back to 1 on viewDidAppear. This made it nice and fast. I also presume that I could remove the views from the superview to speed it up as well.

Does anyone else jump through these kind of hoops on the iPhone. Is there something else I should be doing to avoid this hack?

+2  A: 

It's not a hack to simplify drawing during animation in order to make the animation more smooth. It is indeed a very valid technique.

You may be able to achieve similar performance improvements by setting all UI elements to Opaque, a technique also used to fix table view cell performance issues. You just have to make sure background colors match.

Kendall Helmstetter Gelner
A: 

This may help your Core Animation debugging

http://darknoon.com/blog/2009/06/29/core-animation-debug-mode/

Jesse Armand
A: 

The main problem I had was I subclassed UIButton to make gradient buttons and I had the boundary mask enabled. This made the performance terrible. I removed that option and made my buttons square and it's blazin now.