每按一下,长按下2针

我通过长时间点击我的应用程序丢弃引脚,我允许用户只丢弃两个引脚并且它的工作我猜...但每次我点击在模拟器中添加一个引脚它添加两个引脚(不仅一个)..这里是代码:
-(void) handleLongPressGesture:(UIGestureRecognizer*)sender
{
    if (pinId < 3) {
        // Here we get the CGPoint for the touch and convert it to
        // latitude and longitude coordinates to display on the map

        CGPoint point = [sender locationInView:self.mapView];       
        CLLocationCoordinate2D coord = [self.mapView convertPoint:point
                                            toCoordinateFromView:self.mapView];

        if (pinId == 1) {
            lat1 = coord.latitude;
            long1 = coord.longitude;

            MapAppAnnotation* annotation;
            annotation = [[MapAppAnnotation alloc] initWithCoordinate:coord
                                                andID:pinId];

            [mapView addAnnotation:annotation];

            MKCircle* circle = [MKCircle circleWithCenterCoordinate:coord
                                        radius:5000];
            [mapView addOverlay:circle];    
            pinId++;

        } else {
            lat2 = coord.latitude;
            long2 = coord.longitude;
            MapAppAnnotation* annotation2;
            annotation2 = [[MapAppAnnotation alloc] initWithCoordinate:coord
                                                andID:pinId];

            [mapView addAnnotation:annotation2];
        }
    } 
}
我想知道我的错是否是错误(代码错误..)或是iPhone模拟器能够像两个不同的长压力一样得到我的长鼠压力......这可能吗?     
已邀请:
当手势开始时,您的选择器将被调用一次,而当手势结束时,您的选择器将再次被调检查手势的状态并对相关动作采取行动。
-(void)handleLongPressGesture:(UIGestureRecognizer*)sender
{
    if (sender.state != UIGestureRecognizerStateEnded) return;

    // otherwise, handle the gesture as before
}
UILongPressGestureRecognizer的类引用说:   长按手势是连续的。   手势开始了   (UIGestureRecognizerStateBegan)时   允许的手指数量   (numberOfTouchesRequired)已经   按下指定的时间段   (minimumPressDuration)和触摸   不要超出允许范围   运动(allowableMovement)。该   手势识别器转换为   每当手指移动时改变状态,   它结束了   (UIGestureRecognizerStateEnded)时   任何一个手指都被抬起。     

要回复问题请先登录注册