Ho un oggetto di tipo di immagine che mi sto spostando utilizzando UIPanGestureRecognizer e ho bisogno di interrompere il riconoscimento di UIPanGestureRecognizer quando l'oggetto raggiunge un determinato frame.Come arrestare UIPanGestureRecognizer quando l'oggetto è stato spostato su un determinato frame
UIPanGestureRecognizer *panRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(move:)];
[panRecognizer setMinimumNumberOfTouches:1];
[panRecognizer setMaximumNumberOfTouches:1];
[panRecognizer setDelegate:self];
[templatePhotoPlaceholderView addGestureRecognizer:panRecognizer];
-(void)move:(UIPanGestureRecognizer *)gestureRecognizer
{
CGPoint translatedPoint = [gestureRecognizer translationInView:templatePhotoPlaceholderView];
if([gestureRecognizer state] == UIGestureRecognizerStateBegan) {
_firstX = [imageview center].x;
_firstY = [imageview center].y;
}
translatedPoint = CGPointMake(_firstX+translatedPoint.x, _firstY+translatedPoint.y);
//NSLog(@" Move center point :%@", NSStringFromCGPoint(translatedPoint));
[imageview setCenter:translatedPoint];
}
Come posso fare questo?
Ciao jbat. Puoi darmi qualche esempio di codice di linea per questo. per arrestare UIGestureRecognizers – user905582