I have an NSArray of custom UIViews (ACTileView). They act as one row. I would like to be able to slide them left or right (which is currently already possible) but have the wrap-around (to create the effect of endless "Tiles" much like the UIDatePickerView on the iPhone). I don't have any ideas anymore on how I can achieve this effect.
Help would be greatly appreciated kind regards, JNK
I once did something similar with 50+ views one could page through. Clearly, for memory reasons you should not load all those views into an array if they are not visible.
So what I did was to have the amount of visible views +2 on each side in my array. Which each change of the position, I would update the array by popping one view off one side and adding the next one on the other side.
I put this logic into the scrollViewDidEndDecelerating
delegate method of the UIScrollView
, but you could also put it into scrollViewDidScroll
and then check for the necessary adjustments of views.
You can re-assign an new NSArray
each time and discard the old one, or do everything in a MSMutableArray
.
If your views are all visible at the same time, use this method and just double the chain.