gpt4 book ai didi

iphone - 找到结束/结束坐标你一个 UISwipeGestureRecognizer

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:56:37 24 4
gpt4 key购买 nike

我可以通过执行以下操作找到滑动开始位置的起始坐标

- (void)oneFingerSwipeUp:(UISwipeGestureRecognizer *)recognizer 
{
CGPoint point = [recognizer locationInView:[self view]];
NSLog(@"Swipe up - start location: %f,%f", point.x, point.y);
}

是否可以找到滑动结束的坐标?我查看了文档,但没有提到。有一些解决办法吗?

非常感谢,-代码

最佳答案

您需要检查手势识别器的状态属性

- (void)swipe:(UISwipeGestureRecognizer *)recognizer
{
CGPoint point = [recognizer locationInView:[recognizer view]];
if (recognizer.state == UIGestureRecognizerStateBegan)
NSLog(@"began: %@", NSStringFromCGPoint(point));
else if (recognizer.state == UIGestureRecognizerStateEnded)
NSLog(@"ended: %@", NSStringFromCGPoint(point));
}

关于iphone - 找到结束/结束坐标你一个 UISwipeGestureRecognizer,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13970711/

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