位置不同CGPoint

发布于 2024-11-05 17:29:05 字数 599 浏览 0 评论 0原文

你好 我如何找到这两个cgpoint?他只给了我一个。

-(void)gestureLoad {

//GESTURE

UIGestureRecognizer *recognizer;


recognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(numTap2:)];
[(UITapGestureRecognizer *)recognizer setNumberOfTouchesRequired:2];
[self.view addGestureRecognizer:recognizer];
self.tapRecognizer = (UITapGestureRecognizer *)recognizer;
recognizer.delegate = self;
[recognizer release];
}

- (void)numTap2:(UITapGestureRecognizer *)recognizer {


CGPoint location = [recognizer locationInView:self.view];


...other actions...
}

多谢!

Hi
how do I locate both the cgpoint? he gives me just one.

-(void)gestureLoad {

//GESTURE

UIGestureRecognizer *recognizer;


recognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(numTap2:)];
[(UITapGestureRecognizer *)recognizer setNumberOfTouchesRequired:2];
[self.view addGestureRecognizer:recognizer];
self.tapRecognizer = (UITapGestureRecognizer *)recognizer;
recognizer.delegate = self;
[recognizer release];
}

- (void)numTap2:(UITapGestureRecognizer *)recognizer {


CGPoint location = [recognizer locationInView:self.view];


...other actions...
}

thanks a lot!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

不知在何时 2024-11-12 17:29:05

从-[UIGestureRecognizer numberOfTouches]的描述来看:

使用此返回值
循环中的方法,您可以要求
使用单个触摸的位置
locationOfTouch:inView: 方法。

因此,为每次触摸调用 -locationOfTouche:inView: 来获取相应的位置。

From the description of -[UIGestureRecognizer numberOfTouches]:

Using the value returned by this
method in a loop, you can ask for the
location of individual touches using
the locationOfTouch:inView: method.

So, call -locationOfTouche:inView: for each touch to get the corresponding location.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文