iPhone: Slide photos by finger
I want to implement something like Iphone Photo Gallery... How to slide images by finger, and how to do that animation if I want to slide photos by clicking 开发者_Python百科on button ? Thanks...
Have a look at Three20 project, it has a lot of this gallery stuff already implemented and is open source. It has swiping through images implemented. If you want to do it by yourself, UISwipeGestureRecognizer would be a good starting point. Have a look at the sample code associated with it.
You need to use a PanGestureRecogniser
on the view you want to slide.
UIPanGestureRecognizer *imgpan = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(scrollBarDrag:)];
[imgpan setMaximumNumberOfTouches:1];
[self.svContainer addGestureRecognizer:imgpan];
[imgpan release];
Define this & as the pan is happening, slide in the next image...Hope i was clear.
精彩评论