I have a UIImageView as one of my tabbarcontroller views, and I've added a UISwipeGestureRecognizer (right and left) to navigate through a series of photos in an NSArray.
However, when swiping it jumps from photo to photo with no smooth transition. I'm not after anything fancy, but even a slide animation would be okay, like as one photo slides in, the other is sliding out the other side. Is this possible with the UISwipeGestureRecgonizer and an NSArray?
The standard solution is to use a
UIScrollView
withpagingEnabled = YES
and multiple image views inside the scroll view. If you want to work with just oneUIImageView
, add a transition animation to the image view's layer when you recognize a swipe:Why do it this way? Why not just use a
UIScrollView
withpagingEnabled
set toYES
? Place your image views inside the scrollview, make sure your contentSize's height is the height of the view you're placing the scroll view in, and your width is the width of all your image views side by side, so you can scroll.