I have a scroll view and i am implementing lazyload with page control. I have taken the pagecontrol sample program by apple.

I load 8 thumbnails in every page and the thumbnails themselves are fetched from the network and updated on the UI. The image views are already present in the UI. In my viewDidScroll method i calculate the page number and then update the other pages above and below it as follows:

The UI is too slow and the user experience is very bad. I want to know how can i make the UI more responsive.

Some other questions are:
1) I have a class which downloads the images and the calling class implements the delegate for the downloader class. Once the image is downloaded the delegate method is called to update the UI. Does this slow down the responsiveness of the UI? How can this be avoided?
2) What is a optimal way to implement downloading of images and updating the ui without having the UI become unresponsive?

EDIT:
I am open to ideas on how to best improve and implement this solution.
I am not creating a thread explicitly but i am using NSURLConnection in async mode, and when data is retrieved the delegate method is called to update the UI.

Are you using different threads for image downloading?
–
MHCFeb 22 '11 at 18:29

Hmmm i have created a class which does async download using NSURLConnection. So when download is complete i call a delegate method to update on the UI. Hence i am not explicitly creating a thread but i guess download takes place in other thread but updating the UI done via delegate method on main thread.
–
Praveen SFeb 23 '11 at 5:40

You are calling loadPage multiple times every time scrollViewDidScroll gets called (at least, I assume you mean scrollViewDidScroll). What does loadPage do? If it blindly triggers off a comms request, no wonder your app is going crazy -- you will be requesting the same thing many times, in parallel -- scrollViewDidScroll will get called for every different offset you see of your scroll view.

Perhaps you should think about using a more appropriate delegate method such as scrollViewDidEndDecelerating: to orchestrate things. Mark Adam's answer is also very good advice.

Yes!! I will look into that. However Mark's answer deals with table view and updating the table view contents is taken care by the class. Here i am handling the scrollview myself. Let me know what you think.
–
Praveen SFeb 23 '11 at 21:01