Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Dj64Mk7

macrumors 65816
Original poster
Sep 15, 2013
1,388
734
I'm building a simple app that allows the user to swipe through a selection of photos. I have an image in the initial view controller, and I added a second view controller with image. I added a Swipe Gesture Recognizer to both views, but I don't know how to implement and connect them.

Any help will be greatly appreciated.

Many thanks.
 

AxoNeuron

macrumors 65816
Apr 22, 2012
1,251
855
The Left Coast
First you shouldn't use a UISwipeGestureRecognizer. It would feel really unnatural. A better alternative would be to use UIPanGestureRecognizer.

You would then check for a certain velocity and when reached, swipe to the next image.

But really, this is a solved problem and has been for years. My personal favorite library in this situation is called SwipeView (that's the cocoapod). But these days you can also use a simple UICollectionView with paging enabled.
 
  • Like
Reactions: Dj64Mk7

Dj64Mk7

macrumors 65816
Original poster
Sep 15, 2013
1,388
734
First you shouldn't use a UISwipeGestureRecognizer. It would feel really unnatural. A better alternative would be to use UIPanGestureRecognizer.

You would then check for a certain velocity and when reached, swipe to the next image.

But really, this is a solved problem and has been for years. My personal favorite library in this situation is called SwipeView (that's the cocoapod). But these days you can also use a simple UICollectionView with paging enabled.

Can you go into a bit more detail on UIPanGestureRecognizer?

I'm sorry for it not being clear to me. I'm very new to iOS Development. I have two View Controllers in Main.storyboard, both with UIImageView's. How do I connect the initial View Controller to the second?
 

bjet767

Suspended
Oct 2, 2010
967
320
How do I connect the initial View Controller to the second?

What you are asking is fundamental to iOS programming and there are a number of ways to make this happen with the easiest being a segue.

What you really need to do is go through the tutorials mention here and on many similar threads and look for the transition you want to achieve.

If you simply want to run a slide show of images there are tutorials out on the web which will walk you through what you need to know.

Additionally this site, http://stackoverflow.com/, is full of answers for what you may be desiring. It is the goto place for code questions and answers.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.