Hello. I am new to programming. I have a paging enabled scroll view with many pages (up to ten) and on every page I have a custom button. Every custom button has a custom image. Everything I have made in Interface Builder. When I load the view controller containing this scroll view, it takes a lot of time to load it because it loads all the pages. How can I improve the load time? Can I implement the lazy loading technique in my case? If yes, how exactly, because I am a beginner. Thank you in advance!
You definitely can. There are several examples of scroll views where the content is loaded/unloaded dynamically as you scroll through.
The following blog post helped me get going with this: http://cocoawithlove.com/2009/01/multiple-virtual-pages-in-uiscrollview.html
You also want to make sure NOT to use [UIImage imageNamed:]
unless you must. This method has internal caching, which is very flakey and unreliable, and if you load enough number of big images, your app will be decapitated fairly quickly -- instead use e.g. [UIImage imageWithContentsOfFile:]
. There is a discussion of this on SO here: http://stackoverflow.com/questions/316236/uiimage-imagenamed-vs-uiimage-imagewithdata -- if you're unsure on how to approach things, read that and make up your mind afterwards.
Hope that helps.