私のアプリケーションでは、 touchesMoved メソッドを使用して左右のスワイプを検出しています。ユーザーが連続して左右にスワイプすると、画像アニメーションが自動的に更新されます。スワイプアクションを検出できましたが、左右に連続してスワイプし始めると、画面が touchmoved イベントを検出しないことがあります。
スワイプ領域に、非表示のボタンを 1 つと、アニメーション用の ImageView をいくつか配置しました。どうしてこうなったのか知りたいので教えてください。
ありがとうございました。
コード:
-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event{
[super touchesMoved:touches withEvent:event];
UITouch *touch = [touches anyObject];
CGPoint newLocation = [touch locationInView:self.view];
CGPoint oldLocation = [touch previousLocationInView:self.view];
if(newLocation.x-oldLocation.x>0){
swipe_direction = 1;
//NSLog(@"left");
}
else{
swipe_direction = 2;
//NSLog(@"right");
}
if(swipe_direction == 1){
//animate images
}
else if(swipe_direction == 2){
//animate images
}
}