I've got a bunch of "slides" which I'm trying to show on the iPad, one at a time, using a UIScrollView. The "slides" are various subclasses of the UIViewController
class.
I'm storing my slides in NSUserDefaults
, represented by NSDictionaries. At startup, I, load the NSArray of NSDictionaries and loop through them, passing the views to the UIScrollView.
Right now this is inefficient, because all of the slides are being held in memory even when they offscreen. I suspect that I should make it behave a little more like the UITableViewController, in terms of reusing slides and releasing slides when they are offscreen and recreating them as they come onscreen.
I have two questions.
Firstly, how does UITableViewController handle the cell-swapping? Where can I find some sample code or algorithms?
Second, How can I re-use slides if they are not all of the same type?