views:

1464

answers:

0

Hi, i've been trying to capture gesture zoom in/out in a UIView.

Code:

NSSet *allTouches = [event allTouches];
NSArray *twoTouches = [allTouches allObjects];
UITouch *first = [twoTouches objectAtIndex:0]; 
UITouch *second = [twoTouches objectAtIndex:1]; 
CGPoint firstPoint = [first locationInView:self];
CGPoint secondPoint = [second locationInView:self];
CGFloat initialDistance = [distanceBetweenPoints(firstPoint, secondPoint)];

I'm using the function distanceBetweenPoints, the problem is that firstPoint or secondPoint always is 0.00, 0.00 and for that reason the result is the value of one of them.

I need that the booth values should be distint to zero for obtain the real distance.

The frame of the view is: (0, 0, 320, 417).

The functionality that i'm developing is something like zoom in/out of google maps.

Thanks,