내가 특정 프레임, 여기서는 버튼 영역을 입력하면 물건을 할 때 - (void) touchesMoved
을 사용하고 있습니다.- (void) touchesMoved 중 한 번만 메서드를 호출하는 방법?
내 문제는 프레임에 들어가면 손가락으로 움직일 때 이 아니라이 아닌 것만을 처리하기를 원합니다.
프레임 안에있는 동안 내 메서드를 한 번만 호출 할 수있는 방법을 알고 있고 같은 touchMove에 다시 입력하면 다시 한 번 호출 할 수 있습니다.
감사합니다.
-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
UITouch *touch = [[event touchesForView:self.view] anyObject];
CGPoint location = [touch locationInView:touch.view];
if(CGRectContainsPoint(p1.frame, location))
{
//I only want the below to me called
// once while I am inside this frame
[self pP01];
[p1 setHighlighted:YES];
}else {
[p1 setHighlighted:NO];
}
}
필요한 영역을 종료 할 때도이 bool 플래그를 재설정해야합니다. "동일한 touchMove에 다시 입력하면 다시 한 번 호출 할 수 있습니다."를 참조하십시오. 질문에 대한 요구 – Vladimir
@Vladimir - 저에게 감사합니다. – willcodejavaforfood