Search code examples
iphoneuiscrollviewcore-animation

how to flick and scroll horizontally


I am trying to do something similar to http://www.winktoolkit.org/previews/63/

As you can see from the youtube video, It has three section I need to do two only.

So the idea is there will be bunch of images divided into two sections and both the sections can be scrolled horizontally by just flicking just like iphone photo app, you see an image and flick it you see another image, you can flick backward and forward. To be more specific, I have put an image of the wireframe that I am working on

https://picasaweb.google.com/lh/photo/PZ-3H3VEujd7b2w9V3UJlJSL2rubFpkbdgdHPXy8M2Q?feat=directlink

EDIT: I should also be able to find out, which image the user has taped on, based on that I have to take some action, for example a detail page.

Thanks for your help.

Thanks, Yogesh


Solution

  • If you want to code it in Objective-C, you need a UIScrollView and set it's property pagingEnabled to YES and the property contentSize to widthOfOnePage*numberOfPages.

    To get the "bullets" you need a UIPageControl. Keep in mind that the UIPageControl does not get updated automatically but you can use the UIScrollView delegate method - (void)scrollViewDidScroll:(UIScrollView *)scrollView to update the active bullet in the UIPageControl.

    For getting the image the user tapped on, use the - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event method.