CollectionView 不在 UIControl 中滚动?

问题描述 投票:0回答:1

我在水平 UICollectionView 中有从 UIControl 继承的按钮。我想添加一个行为,这样即使我们水平滚动按钮,我的按钮也不会被触摸到,首先滚动会捕捉到 UICollectionView

-- UICollectionView
    -- UIControl (button)
    -- UIControl (button)
    -- UIControl (button)

如何做到这一点?

swift uicollectionview uikit uigesturerecognizer uicontrol
1个回答
0
投票

UICollectionView 继承自 UIScrollView。所以你可以访问;

open var isTracking: Bool { get } // returns YES if user has touched. may not yet have started dragging

open var isDragging: Bool { get } // returns YES if user has started scrolling. this may require some time and or distance to move to initiate dragging

open var isDecelerating: Bool { get } // returns YES if user isn't dragging (touch up) but scroll view is still moving

我会使用这些检查来查看集合是否在滚动,如果是,则从所有按钮点击返回。

© www.soinside.com 2019 - 2024. All rights reserved.