2

I am having difficulty figuring out how I can allow the user to scroll outside of the bounds of the UIScrollView. My goal is to get my scrollView to respond when I swipe left or right inside of the scrollView AS WELL AS the marked area shown in black.

Any help is greatly appreciated.

UIScrollView

Soja
  • 514
  • 6
  • 13
  • See [the OP's code, and the answers here](http://stackoverflow.com/questions/42291815/recognize-swipe-gesture-in-uiview-to-scroll-the-scrollview-using-gesture-recogni/43833847#43833847) for a solution. – troyshu May 07 '17 at 16:27

1 Answers1

0

Figured it out but here's the answer in case you have the same problem.... 1) In your scrollview attribute inspector, click "Scrolling disable" 2) In Main storyboard, dropped couple Swipe Gesture Recognizers on top of your View (not scrollView). Change the first recognizer swipe to left, then the second one to right. 3) Create an @IBAction for both recognizers. 4) Write your code that checks for swipe direction and offsets the content of your scrollView accordingly using scrollView.setContentOffset

Soja
  • 514
  • 6
  • 13
  • 1
    Does this work with bouncing? Doesn't sound like a good idea. – Léo Natan Dec 21 '16 at 15:28
  • Currently it only work with left and rght swipes. I didn't add bouncing effect to it. I'm sure there is a much better solution, but I'm fairly new to swift development, so will stick with it for the moment. If you find better ways, do let me know. Thanks. – Soja Dec 21 '16 at 18:36