从 UILongPressGestureRecognizer 获取屏幕坐标 [英] Getting screen coordinates from UILongPressGestureRecognizer

查看:38
本文介绍了从 UILongPressGestureRecognizer 获取屏幕坐标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在 iOS 应用中实现 UILongPressGestureRecognizer.它按预期触发,但我没有看到将屏幕坐标传递给我的目标方法.有人知道怎么做吗?

I am trying to implement a UILongPressGestureRecognizer in an iOS app. It fires as expected, but I don't see anyway of passing screen coordinates to my target method. Does anyone know how to do this?

推荐答案

这似乎是一个动作:

- (void)receivedLongPress:(UIGestureRecognizer *)gestureRecognizer 
{
     CGPoint coords = [gestureRecognizer locationInView:gestureRecognizer.view];
}

我仍然不太明白(似乎最后一个接触点存储在gestureRecognizer中,在这种情况下,我希望只有一个属性或其他东西).但是,嘿,它有效.

I still don't really understand (it seems like the last touch point is stored in the gestureRecognizer, in which case I would expect there to just be a property or something). But hey, it works.

这篇关于从 UILongPressGestureRecognizer 获取屏幕坐标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆