UIPanGestureRecognizer get cords of all touches

iphone, objective-c, uipangesturerecognizer

Solution

You can access all the touches using these methods:

- `(NSUInteger)numberOfTouches`

- `(CGPoint)locationOfTouch:(NSUInteger)touchIndex inView:(UIView *)view`

They are defined in the base class, UIGestureRecognizer.

Problem

I have added the following gesture recognizer: ``` UIPanGestureRecognizer *d2 = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(ViewDragging2:)]; [d2 setMinimumNumberOfTouches:2]; [d2 setMaximumNumberOfTouches:2]; [targetView addGestureRecognizer:d2]; ``` and the method that get's fired when that event occurs is: ``` -(void)ViewDragging2:(UIPanGestureRecognizer*)sender { // some point CGPoint translatedPoint = [(UIPanGestureRecognizer*)sender translationInView:targetView]; } ``` that get's me the point of one touch even though I touch with two fingers. How can I retrieve the cords of the first and second touch?

Original source