touchesMoved 메소드를 사용하여 왼쪽/오른쪽으로 스 와이프를 감지했습니다. 사용자가 왼쪽과 오른쪽으로 계속 스 와이프하면 이미지 애니메이션이 자동으로 업데이트됩니다. 스 와이프 동작을 감지 할 수 있었지만 가끔씩 왼쪽 및 오른쪽으로 스 와이프를 시작하면 화면에 touchmoved 이벤트가 감지되지 않습니다.touchesMoved 감지가 제대로 작동하지 않습니다. 내 애플리케이션에서
스 와이프 영역에 하나의 숨겨진 버튼과 애니메이션 용 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
}
}