开发者

Simulating Pinch on iOS simulator with Option/Alt key

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 shou开发者_C百科ldn't work if the outer UIView is not looking for the pinchgesture according to the documentation.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜