I am creating a 36 page bookapp where each page has a different set of features including transforming images, tappable screen objects, sound effects, narration, and occasionally embedded video. The features are different per page.
My programming problem:
Currently, each page has its own view controller and NIB and modally calls the next page of the book when its time to change the page. Since modal calls seem to act like they are nested, I am unable to release all of the previous pages’ viewcontrollers, resources, etc. and memory quickly becomes an issue.
Request for help:
What structure for switching views might be more appropriate for this? I have read about the options available on the dev site (Nav, table, modal, etc.) and looked for appropriate examples online without luck. I would like to be able to do the page turn curls with whatever switching method is used.
Any thoughts? Thanks for your help!
You could have a view controller – call it book – that’s responsible for changing pages. Each page could use the same protocol that would let the book know when to change pages. When book receives the appropriate messages (turnpageforward, turnpageback), book would instantiate the proper view controller for the next page to be viewed, remove the currently viewed page from the view, and add the new page to the view.
This way, you’d only need to keep one page active and in memory at the same time. You’d also be able to facilitate things like turning to a page that’s not immediate next or immediate last.
Does that help? I’d be happy to elaborate if necessary.