2D UIScrollView with view reuse and resetting to0 y offset on each scroll
I'm working on an app that requires showing a 2D paging scrollview (scrolls a grid of images in x and y axes). It will be used to display a number of products (scrolling left to right) which each have a different number of images to view (scrolling up and down). Due to the grid having a large number of images I know I need to reuse the imageViews as the scrollview is scrolled. One issue is that as each product will have any number of images (from 1 to 10) we need to ensure that as the user swipes left or right to another product the first one is displayed, and therefore the user can only s开发者_Go百科croll down (not up) a number of pages equal to the number of images available for that product.
Does anyone have any experience with something like this? As an example please see the zozo town app.
I'm not sure if I've explained this very well so I'll happily clarify anything that's not clear.
Thanks!
After each time the user scrolls to a different page, it will hit the following delegate method:
- (void)scrollViewDidScroll:(UIScrollView *)scrollView
Use that method to figure out which product the user is viewing by looking at the current content offset x value. At this point you can set the scrollView's contentSize appropriately based on what you already have loaded.
After each image loads, you can resize the scrollView's contentSize to be larger.
精彩评论