Rythm
Rythm

Reputation: 191

Tableview in scrollview in swift

I have used https://github.com/nrlnishan/ViewPager-Swift for Paging menu. I have added 3 viewcontrollers in it which all contains tableviews. But when I try to scroll in tableview the views are scrolling horizontally. I want to increase the resistance of the scrollview so that I can scroll the table at once.

If anyone knows some property of the scrollview or pageviewcontroller which helps me to stop scrolling horizontal while I am scrolling the tableview.

Thanks.

Upvotes: 2

Views: 1682

Answers (1)

nihilvex
nihilvex

Reputation: 231

Usually when you have nested scrollviews or conflicting gestures you use requireGestureRecognizerToFail: to solve the problem. In your case you can use the panGestureRecognizer property of the scrollview and the tableviews.

Like this:

scrollView.panGestureRecognizer.requireGestureRecognizerToFail(tableView.panGestureRecognizer)

Upvotes: 1

Related Questions