Michael Peterson
Michael Peterson

Reputation: 13

UIScrollView Vertical Scrolling when touching inside a subview

I have implemented a scrollview, which holds multiple copies of a custom view. The custom views contain a UIPanGestureRecoginixer that I use to swipe them to the left (to delete them). When I attempt to scroll vertically, scrolling doesn't occur if I'm touching inside of the CustomView. However if I set up the subViews and the scrollviews content size so that it scrolls horizontally this issue doesn't occur. How can I force the scrollview to scroll horizontally even if I'm touching inside of a subview?

Upvotes: 1

Views: 276

Answers (1)

David
David

Reputation: 21

Try to set the UIPanGestureRecoginzer's delegate and implement

- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer

It requires you to return a BOOL value. When you return YES, the otherGestureRecognizer will be recognized simultaneous.

Upvotes: 1

Related Questions