我有一个 UIScrollView,我希望它能够在两个方向上滚动(目前是这样),但一次只能滚动一个方向。因此,例如,如果您开始水平滚动它,它根本不会垂直移动,直到您放手并开始垂直移动它。我该怎么做呢?
最佳答案
将 directionalLockEnabled
属性设置为 YES。来自 Apple 文档:
If this property is NO, scrolling is permitted in both horizontal and vertical directions. If this property is YES and the user begins dragging in one general direction (horizontally or vertically), the scroll view disables scrolling in the other direction. If the drag direction is diagonal, then scrolling will not be locked and the user can drag in any direction until the drag completes. The default value is NO
关于iphone - UIScrollView 一次只向一个方向滚动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11001938/