Search code examples
objective-ciphonexmlpaginationuiscrollview

UIScrollView application (w/ paging enabled) to load images only relevant to current page


I am wondering if anyone can offer any advice towards solving this problem.

I am building an app that uses a UIScrollView with paging enabled, with each page corresponding to downloaded and parsed XML data. Part of that XML data is a URL to an image.

Now, it would take forever to load an app that downloads the image for every XML entry and then push it to the respective UIScrollView page created on runtime with the rest of the XML data.

Is there a way to be able to detect which UIScrollView page you are on and then download the image as needed and still allow the rest of the data to download at runtime?


Solution

  • Just as referenece, I solved it by adding all of the image views into an NSArray. Using the scroll view delegate, I was able to determine which page number I was on, and translated that page number to an integer that I used to access the appropriate uiimage view located within the array.

    It seems to work great!

    Might you offer a better solution?