Simulating Pinch on iOS simulator with Option/Alt key

Crystal picture Crystal · Jun 9, 2011 · Viewed 7.5k times · Source

Has anyone had problems with pinching in the iOS simulator on a UITableView? I have this code:

UIPinchGestureRecognizer *pinch = [[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(handlePinch:)];
[self.tableView1 addGestureRecognizer:pinch];
[pinch release];

UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTouch:)];
[self.tableView1 addGestureRecognizer:tap];
[tap release];

in my viewDidLoad method. In my handlePinch: and handleTap: methods, I simply NSLog(@"pinched") or @"tapped". The tap works, but the pinching does not. Is there a bug in the simulator, or am I not simulating it correctly for UITableView? (hold option key for the two circles, click on the mouse, then drag to simulate pinching)

Edit: I selected multiTouchEnabled for the tableView and it does not recognize the pinch. However if I change the outer container UIView and add the pinchgesture to the UIView, then it seems to work. But I don't think that it shouldn't work if the outer UIView is not looking for the pinchgesture according to the documentation.

Answer

Deepak Danduprolu picture Deepak Danduprolu · Jun 9, 2011

If you are using a XIB, it's likely that multipleTouchEnabled is NO. Set it to YES for pinch to work.