Reputation: 7466
I need to display 10 - 1000 images on a UIScrollView. Paging is enabled. So every page of the scrollview is an image, it is an uiimage. I can load 10 images to 10 uiimages which stays in the memory, but with 1000 images I have problems on the iPhone or on the iPad. I am trying to unload and then load the images when I am doing scrolling. I every time displays 3 images. The current page image, and the -1 and +1 pages. When I am scrolling I unload the image and then load the next. With this method I have two problems. The scrolling is laggy and if I scroll very fast the images don't appear. Maybe is there any good solution for these problems? Can you suggest me one?
Upvotes: 0
Views: 1013
Reputation: 5372
Perhaps the TTPhotoViewController from the three20 project would be useful.
Upvotes: 1
Reputation: 64428
You should use a table with large custom cells each containing one image view. That way you never have more than a few image views in existence at anyone time. The table will manage swapping out the images that should be visible for you so you don't have to write all that code yourself.
However, even with a table you will get poor performance if you try to display 1,000 large (say 20%+ of screen size) images. I haven't tried this on the iPad but the iPhone just doesn't have the horsepower and memory to handle that many images quickly.
Instead, you should copy the Photo Library's hierarchical system. Present thumbnails and then a detail view for the full image or a side to side scrolling detail view that only shows one image at time. This has the added advantage of being an interface the user is already perfectly familiar with.
Upvotes: 2