Objective c 如何在longpress中获得触控定位?

Objective c 如何在longpress中获得触控定位?,objective-c,cocoa-touch,xcode4,ios4,touch,Objective C,Cocoa Touch,Xcode4,Ios4,Touch,在我的应用程序中,我添加了手势和这些方法 UITapGestureRecognizer *doubleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleDoubleTap:)]; UITapGestureRecognizer *singleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:

在我的应用程序中,我添加了手势和这些方法

    UITapGestureRecognizer *doubleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleDoubleTap:)];

    UITapGestureRecognizer *singleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleSingleTap:)];

    UILongPressGestureRecognizer *longpress =[[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(handellongpress:)];

    - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
           UITouch *start = [[event allTouches] anyObject];
           CGPoint StartPoint = [start locationInView:self.view];
           NSLog(@"start points x : %f y : %f", StartPoint.x, StartPoint.y);
    }
    -(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event{
           UITouch *move = [[event allTouches] anyObject];
           CGPoint MovePoint = [move locationInView:self.view];
           NSLog(@"MovePoint  x : %f y : %f", MovePoint.x, MovePoint.y);
    }

    -(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event{
           UITouch *end = [[event allTouches] anyObject];
           CGPoint EndPoint = [end locationInView:self.view];
           NSLog(@"end ponts x : %f y : %f", EndPoint.x, EndPoint.y);
    }

    -(void)handellongpress:(UITapGestureRecognizer *)recognizer {
        CGPoint LongTapPoint = [recognizer locationInView:self.view];
        NSLog(@"LongTapPoint.x %f,LongTapPoint.y %f",LongTapPoint.x,LongTapPoint.y);
    }

- (void)handleSingleTap:(UITapGestureRecognizer *)recognizer {
       CGPoint SingleTap = [recognizer locationInView:self.view];
       NSLog(@"SingleTap.x %f,SingleTap.y %f",SingleTap.x,SingleTap.y);
}

- (void)handleDoubleTap:(UITapGestureRecognizer *)recognizer {
       CGPoint doubleTapPoint = [recognizer locationInView:self.view];
   NSLog(@"doubleTapPoint.x %f,doubleTapPoint.y %f",doubleTapPoint.x,doubleTapPoint.y);
}
现在我想要的是用户在某个地方触碰,拖动到一个新的地方,然后保持一段时间,如何检测最后的位置。我面临着一个问题,如果用户从按钮位置开始滑动,touchMove和touchEnd location方法将无法调用。 如何在longpress中调用touchEnd方法

if(gestureRecognizer.state == UIGestureRecognizerStateBegan)   
{   
    NSLog(@"UIGestureRecognizerStateBegan");   
}   
else if(gestureRecognizer.state == UIGestureRecognizerStateEnded)   
{   
    NSLog(@"UIGestureRecognizerStateEnded");   
}   
else if(gestureRecognizer.state == UIGestureRecognizerStateChanged)   
{   
    NSLog(@"UIGestureRecognizerStateChanged");   
}   
else if(gestureRecognizer.state == UIGestureRecognizerStateCancelled)     
{   
    NSLog(@"UIGestureRecognizerStateCancelled");   
}   
else if(gestureRecognizer.state ==UIGestureRecognizerStateFailed )   
{   
    NSLog(@"UIGestureRecognizerStateFailed");   
}
使用gestureRecogizer.state