Using UIImageViews for 'pages' in an iPhone/iPad storybook app?
I'm new to iPhone programming, and well, what seems obvious to me may seem silly to a seasoned coder. I did a few 'switching views' tutorials on Youtube, and basically, they seems to work nicely for adding pages to a storybook type app. You add a UIView开发者_如何学运维Controller and associated view for each page.
My question is would this become insanely slow, or a memory hog if I continued this method for say....35+ pages? Each page would also have a sound file associated with it that would play narration when a page load and stops when we leave. Basically, think of a powerpoint type app, with sound, possibly animated image elements, next & back buttons.
I'm probably thinking of this very simplistically, but that's where my experience is at for the moment. Any insight or tips as to better and or more efficient ways to proceed would be greatly appreciated.
WHat you can do is unload the pages you are not using, that way you wont have to worry about any number of pages..you can also maybe keep the pages that come next and the one that comes before so there wont be any lag between clicking next and previous and viewing the new page.
In addition to Daniel's suggestion - which should happen automatically as the UIViewController
s representing pages are no longer displayed, you should create a subclass of UIViewController
to manage all the shared behaviour (next/back, playing sounds), and make your pages either a subclass of that, or instances of that class with the right values set in it.
For PowerPoint type animation (or rather, for a lot better we say Keynote), take a look at Core Animation.
精彩评论