在 Xcode/iPhone 模拟器中工作,我有一个应用程序UIGestureRecognizers
用于捏、点击和平移。在不更改任何代码的情况下,不再识别捏合(我在移动鼠标时按住选项键以显示两个灰色圆圈一起或分开移动)。平移和点击仍然有效。有没有其他人遇到过这个问题?
识别器本身或模拟器似乎有问题,因为下面的捏合代码从未被调用,但它适用于平移。
- (void)pinch:(UIPinchGestureRecognizer *)gesture
{
NSLog(@"in pinch method");
if ((gesture.state == UIGestureRecognizerStateChanged) ||
(gesture.state == UIGestureRecognizerStateEnded)) {
self.scale *= gesture.scale; // adjust our scale
gesture.scale = 1; // reset gestures scale so future changes are incremental
}
}
- (void)tap:(UITapGestureRecognizer *)gesture
{
NSLog(@"in tap method");
if (gesture.state == UIGestureRecognizerStateEnded)
self.originInPixels = [gesture locationInView:self];
}
我尝试使用简单的 MKMapView 创建一个新应用程序,它可以正确加载地图,并且平移和点击工作 - 但捏仍然不起作用。
我正在使用 iOS 5.1。
有任何想法吗?