0

I have a UIScrollView and I am adding many viewcontrollers having UITableView in it on that scrollview,Actually my requirement is that when I scroll horizontally on screen it will switch to next content.Now when I scroll the table vertically and then swipe horizontally it does not scroll horizontally until table stops scrolling vertically.

Please help if you have any suggestion

Buntylm
  • 7,345
  • 1
  • 31
  • 51
Divyant
  • 69
  • 1
  • 8

1 Answers1

0

You could use UIScrollViewDelegate methods. E.g. scrollViewDidEndDecelerating: and scrollViewDidEndDragging:willDecelerate: to know when your vertical scrolling is finished.

If it's enough for you to just lock the horizontal scrolling while performing the vertical one, then you can do the lock on the start of vertical scrolling (e.g. in scrollViewDidScroll) and unlock horizontal scrolling when finished (see the methods above) with vertical. Also you can take a look at this topic where different solutions are proposed.

P.S. To disable horizontal scrolling, but to leave the vertical, you can for example change scrollview's contentsize as described here.

Hope this helps.

Community
  • 1
  • 1
makaron
  • 1,585
  • 2
  • 16
  • 30