我有一個使用UIPanGestureRecognizer移動的圖像類型對象,並且當對象到達特定幀時我需要停止識別UIPanGestureRecognizer。如何當對象移動到特定幀時停止UIPanGestureRecognizer
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];
}
我該怎麼做?
嗨jbat。你能給我一些線代碼的例子嗎?用於停止UIGestureRecognizers – user905582