Implementing scroll view that is much larger than the screen view with random images
- by pulegium
What I'm trying to do is to implement something like the fruit machine scroll view. Basically I have a sequence of images (randomly generated on the fly) and I want to allow the users to scroll through this line. There can fit approx 10 images on the screen, but the line is virtually unlimited.
My question is what would be the best approach in implementing this?
So far I've thought of having a UIImageView going across the screen (with width equal to the sum of 10 images) and the image associated with it would be a combination of 12 or so images, with two images falling out of the visible area, this would allow for smooth scrolling. If the user scrolls further, then I would reconstruct the image associated with the view so the new images are appended and the old one's are discarded.
This image reconstruction business sounds bit complicated, so I was wondering if there's a more logical way to implement this.
There's one more thing, I want to have two lines crossing each other with images, bit like conveyor belts crossing. If that makes any sense... Bit like below:
V1
V2
H1 H2 H3 H4 H5
V4
V5
So if the vertical belt is moved it'd be like:
V2
H3
H1 H2 V4 H4 H5
V5
V6
H1-H5, V1-V6 being automatically generated images.
I'm not asking for the implementation code, just the thoughts on the principles how to implement this. Thanks!! :)