How do I stop a UIScrollView from bouncing horizontally?

后端 未结 11 1775
名媛妹妹
名媛妹妹 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:10

    If anyone developing for OS X is looking here, as of OS X 10.7, the solution is to set the horizontalScrollElasticity property to false/NO on the scroll view, like this:

    Swift:

    scrollView.horizontalScrollElasticity = false
    

    Objective-C:

    scrollView.horizontalScrollElasticity = NO
    

提交回复
热议问题