gpt4 book ai didi

iphone - UIScrollView 一次只向一个方向滚动

转载 作者:IT王子 更新时间:2023-10-29 08:04:30 24 4
gpt4 key购买 nike

我有一个 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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com