Reputation: 705
I am working on an app, and wanted to know if the following would be possible. I have a UIScrollView on top of an existing UIView which has UIButtons. The UIScrollView stops the touches from reaching the UIButtons below it.
Can I detect user touches on the UIButtons that is below the UIScrollView? The UIScrollView has clear backgroundColor so the user can still see everything under it.
Any help would be appreciated.
Upvotes: 2
Views: 539
Reputation:
I am not a Swift coder, i could link you all the methods , but I guess you can handle it yourself, unless you can't let me know I will update the answer. However, the solution for you:
First you need to add a UITapGestureRecognizer with a single tap to your UIScrollView.
Detect the tap CGPoint (user touchpoint) inside your tapGesture method: (Objective-c)
CGPoint touchPoint=[gesture locationInView:scrollView];
Then do a check if the touchPoint is inside the view below it with CGRectContainsPoint
bool CGRectContainsPoint(CGRect rect, CGPoint point);
If so, just fire the action, otherwise ignore it. :)
Upvotes: 2