gpt4 book ai didi

ios - 获取 UICollectionView 的按下和常量坐标

转载 作者:行者123 更新时间:2023-11-29 02:47:10 24 4
gpt4 key购买 nike

当用户按下 UICollectionView 中的单元格时,我想执行一个操作。实现委托(delegate)很容易做到这一点

- (void)collectionView:(UICollectionView *)collectionView didHighlightItemAtIndexPath:(NSIndexPath *)indexPath {

}

但是,我还希望获得有关用户手指在屏幕上的位置的持续反馈。为此,我正在考虑添加一个 UILongPressGestureRecognizer。这有道理吗?

最佳答案

根据文档UILongPressGestureRecognizer我相信是这样。不过,要使其正常工作,他们的手指需要始终触摸屏幕。因此,除了这个手势识别器之外,实现 UICollectionViewDelegate 方法来取消/选择 Collection View 中的项目似乎是不必要的。

Long-press gestures are continuous. The gesture begins (UIGestureRecognizerStateBegan) when the number of allowable fingers (numberOfTouchesRequired) have been pressed for the specified period (minimumPressDuration) and the touches do not move beyond the allowable range of movement (allowableMovement). The gesture recognizer transitions to the Change state whenever a finger moves, and it ends (UIGestureRecognizerStateEnded) when any of the fingers are lifted.

关于ios - 获取 UICollectionView 的按下和常量坐标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24978070/

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