开发者

location different CGPoint

开发者 https://www.devze.com 2023-03-04 06:46 出处:网络
Hi how do I locate both the cgpoint? he gives me just one. -(void)gestureLoad { //GESTURE UIGestureRecognizer *recognizer;

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:r开发者_开发知识库ecognizer];
self.tapRecognizer = (UITapGestureRecognizer *)recognizer;
recognizer.delegate = self;
[recognizer release];
}

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


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


...other actions...
}

thanks a lot!


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消