Possible Duplicate:
How do I enable directional lock for a UIScrollView?
Is there a way to have a UIScrollView perform paging e.g. only horizontally and not when scrolling vertically?
In other words, I want my scrollview to snap to page boundries when scrolling horizontally and free swiping when going vertically.
Of course the trivial solution is using two UIScrollViews, one in each direction, but this is not a feasible solution in my case.
Presuming you always want snap if there is any movement in horizontal direction and free scrolling only if the horizontal offset has not changed.
scrollViewDidScroll:
)This will simulate the scenario you want. If you swipe horizontally the page will snap - and the vertical snap will be minimal due to the fame height being set to 1.
When swiping only vertically, the scrollview will scroll freely.