0

I have n UIScrollView that fit the whole screen, and a UIView displayed in front of it. I would like to transfer touch events from the UIView to the UIScrollView, such as:

  • when I move my finger on the UIView, the UIScrollView scrolls accordingly (with preserved inertia)

  • the UIView may contain buttons, so userInteractionEnabled = false is not a good solution

  • when I move my finger on the UIScrollView, the UIScrollView scrolls as usual

If anyone has a solution, please don't hesitate.

Thanks in advance.

picture

Hyperbole
  • 3,917
  • 4
  • 35
  • 54
  • Try this, seems it is Dup of - http://stackoverflow.com/questions/7488551/how-to-pass-touches-from-uiview-to-uiscrollview – Santosh Sep 16 '16 at 14:09
  • Thank you for your answer, I put the repo so you can see we did something like you show me, but it didn't work. Perhaps we did something wrong https://bitbucket.org/JPEG06/testgesture/src – Jean-Philippe Arnaudin Sep 16 '16 at 14:34

1 Answers1

0

Create a custom UIView then implement this delegate:

- (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event {
    //return NO to disable click to this UIView and then the click will be forward to the view behind.
    return NO;
}

Apparently, you can also try with set the value of .userInteractionEnabled to NO

Duyen-Hoa
  • 15,384
  • 5
  • 35
  • 44