最近维护之前用iOS SDK 3.2写过的3年多前的map方面的模块,在地图上长按pin,发觉一个点莫名奇妙点插了两个pin。查了一下,原来是现在的sdk要在UILongPressGestureRecognizer绑定的selector方法里对UILongPressGestureRecognizer.state 进行下判断,额,蛋疼。下附问题解决办法:
//长按地图事件
- (void)longPressGestureRecognizerAction:(UILongPressGestureRecognizer* )gestureRecognizer
{
if (gestureRecognizer.state == UIGestureRecognizerStateEnded) {
NSLog(@"Long press Ended");
}
else {
NSLog(@"Long press detected.");
//OOXX.....
}
}
参考:
http://www.cocoachina.com/ask/questions/show/108149
http://blog.csdn.net/yu0089/article/details/8244851