1

In my app I have a UIScrollView and I need to swipe left and right from one picture to the next, but I also need to recognize a scroll.

How do I differentiate between a scroll and a swipe with UIScrollView?

rmaddy
  • 314,917
  • 42
  • 532
  • 579
etayluz
  • 15,920
  • 23
  • 106
  • 151

2 Answers2

1

Look into the UIScrollView Delegate Methods. ScrollView can detect different types of actions drag etc or add swipeGesture directly to the scroll view

StackOverflow has questions already on this

iOS: UIScrollView detecting Swipe Gesture

Setting up UIScrollView to swipe between 3 view controllers

How to recognize swipe gesture in UIScrollView

Community
  • 1
  • 1
JSA986
  • 5,870
  • 9
  • 45
  • 91
1

I believe you're actually looking for is an implementation of UIScrollView with Paging, as you do not need to handle the touch events yourself, or determine if they are scrolls or swipes.

The Apple Documentation on Scroll Views and Paging Mode should help you get started

Joshua Finch
  • 1,585
  • 2
  • 9
  • 6
  • Good point! However, it seems that Scrolling Using Paging Mode requires full screen, and I'm looking for a scroller that will occupy about 30% of the screen height. Is it still possible? – etayluz Jan 17 '15 at 07:26
  • Never mind - I see that I can set the height to anything I want – etayluz Jan 17 '15 at 07:34