This should be pretty easy. Create two gesture recognisers. the UIPinchGestureRecognizer and the UIPanGestureRecognizer. Don't forget to become the delegate of both!
pinchRecognizer = [[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(scaleHandler:)];
[pinchRecognizer setDelegate:self];
[pinchRecognizer setDelaysTouchesBegan:NO];
[pinchRecognizer setDelaysTouchesEnded:NO];
[pinchRecognizer setCancelsTouchesInView:NO];
panRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(panHandler:)];
[panRecognizer setMaximumNumberOfTouches:2];
[panRecognizer setMinimumNumberOfTouches:1];
[panRecognizer setDelegate:self];
[panRecognizer setDelaysTouchesBegan:NO];
[panRecognizer setDelaysTouchesEnded:NO];
[panRecognizer setCancelsTouchesInView:NO];
Now implement the following method of the gesture delegate.
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer{
return YES;
}
This will make both handlers be triggered, so that when you release one of the fingers it will pan, but when you have both of them it will pinch.