views:

173

answers:

2

I am trying to implement a filmstrip-like UIScrollView that will be populated with thumbnails of catalog pages. Selecting a thumbnail image will cause the main UIScrollView to move to the selected page. The Catalog may contain 100 - 200 pages, and I want to load them lazily only when required.

I have done this in a UIScrollView with paging enabled, but haven't seen anything on the best way to do this in a non-paging scenario. There will be 6 thumbnails visible in the UIScrollView (+ 1 when the view is being scrolled) at any one time. I want to dequeue and reuse the thumbnail's UIView when the view is scrolled, as I am doing in the main UIScrollView (which is a paging scroll view).

Thanks -

Jk

+1  A: 

Check out the scrollview suite sample code from apple. The tiled example can probably be repurposed very easily.

http://developer.apple.com/iphone/library/samplecode/ScrollViewSuite/Introduction/Intro.html

Jerry Jones
Thanks, Jerry. The thumbnail view in the Tiled example is exactly what I am doing, but the example simply loads the four thumbnail views in when the view is created. I need to load thumbnail views dynamically as needed. I don't want the memory hit of up to 200 thumbnail views at one time in the scrollView.Jk
Alpinista
A: 

I am also going to suggest you take a look at some sample code of Apple, that is, Photo Scroller. If you are a registered iOS developer, you should also take a look at the WWDC10 session about scroll views in iPhone applications.

http://developer.apple.com/library/ios/#samplecode/PhotoScroller/Listings/main_m.html

What you need to do is mimic the behavior of a table view (which is nothing more than a subclass of UIScrollView). What you should mimic is the reuse of the cells. It is pretty easy to implement and will dramatically reduce the memory foot print of your application since you only load the content that is currently visible in the scroll view.

I hope this helps.

bare_nature