How do I stop a UIScrollView from bouncing horizontally?

后端 未结 11 1777
名媛妹妹
名媛妹妹 2021-02-05 12:07

I have a UIScrollView that shows vertical data, but where the horizontal component is no wider than the screen of the iPhone. The problem is that the user is still able to drag

11条回答
  •  醉话见心
    2021-02-05 12:22

    Make sure the UIScrollView's contentSize is not wider than the UIScrollView itself. In my own apps this was enough to avoid horizontal scrolling, except in cases where I got really crazy swiping in random directions (e.g., starting a scroll while the view was still decelerating).

提交回复
热议问题