位置不同CGPoint
你好 我如何找到这两个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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
从-[UIGestureRecognizer numberOfTouches]的描述来看:
因此,为每次触摸调用 -locationOfTouche:inView: 来获取相应的位置。
From the description of -[UIGestureRecognizer numberOfTouches]:
So, call -locationOfTouche:inView: for each touch to get the corresponding location.