I performed a panorama gesture in the image view. I set the number of touches to 2.
While the user starts panning, he will go into if ([sender state] == UIGestureRecognizerStateBegan), as well as if (sender.numberOfTouches == 2) and im gets the value of no: touches as 2.
But when the user has finished panning, he enters ([sender state] == UIGestureRecognizerStateEnded), but is not included in if (sender.numberOfTouches == 2), and no: of Touches in ends, indicates as 0;
I tested again and again to make sure the strokes ended with two fingers, but the result for the end is zero.
Can someone please help me with this. Please tell me where I am going wrong.
I am completely stuck at this point.
- (void)panGestureHandler:(UIPanGestureRecognizer *)sender { if ([sender state] == UIGestureRecognizerStateBegan ) { gesture_ = [[SSGesture alloc]init]; if (sender.numberOfTouches == 2) { startLocation = [sender locationInView:self.view]; CGPoint firstPoint = [sender locationOfTouch:0 inView:self.imageView]; initialPointOne.x = [NSString stringWithFormat:@"%.0f",firstPoint.x]; initialPointOne.y = [NSString stringWithFormat:@"%.0f",firstPoint.y]; initialPointOne.index = @"1"; CGPoint secondPoint = [sender locationOfTouch:0 inView:self.imageView]; SSCoordinate *initialPointTwo = [[SSCoordinate alloc]init]; initialPointTwo.x = [NSString stringWithFormat:@"%.0f",secondPoint.x]; initialPointTwo.y = [NSString stringWithFormat:@"%.0f",secondPoint.y]; initialPointTwo.index = @"2"; gesture_.initialSet = [[NSArray alloc]initWithObjects:initialPointOne,initialPointTwo, nil]; } } else if ([sender state] ==UIGestureRecognizerStateEnded ) { NSLog(@"dsfssdf %d",sender.numberOfTouches); if (sender.numberOfTouches == 2){ SSCoordinate *firstPoint = [gesture_.initialSet objectAtIndex:0]; CGPoint offset = [sender translationInView:self.imageView];
source share