views:

524

answers:

3

Hello all -

I need to create a view on the iPhone that scrolls horizontally through a gallery of images. The issue is that this gallery has the potential to have 100s to 1000s of images that needs to be presented, so I would like to avoid loading them all into a single UIScrollView at once and destroying performance. I need to create a view that recycles the view objects (like UITableView) to increase performance and reduce memory overhead, but it needs to scroll in a horizontal fashion.

Any ideas? Is it possible to make UITableView operation horizontally?

Thanks!

+1  A: 

You could use a large scrollview, and monitor for the scroll position to change. You can add images as subviews as they are coming into the actual viewable area, and remove them as they are scrolled away.

This way, you only have to have a small number of image views present at any given time, but you give the appearance of them all being "there".

You could even recycle the image views by changing their image and location so you are not creating and destroying complex objects. This is what UITableView does with cells.

mbmcavoy
Thanks for the thoughts. I was hoping there would be a way to use a recycling mechanism in the OS, and not have to manage all that in my own code...but I will make some attempts with that and see how it performs.
Wireless Designs
A: 

Hey Wireless Designs,

Did you find a way to make a UITableView scroll horizontally? I'm looking for similar functionality on my app.

Cheers!

dineth
A: 

I agree with mbmcavoy, you can also take a look iPhone/iPad – AppStore like UIScrollView with paging and preview this article explains what you need about UIScrollView as well as provides a good example and source code.

Regards

fyasar