2014-01-08 1 views
1

여기에 약간의 구성이 있습니다. 나는 UITableViewCell을 확장하고 UITableViewCelltouchesBegin이 올 때 UITableViewController 클래스에서 모달로 UIViewController을 표시하고 있습니다. touchesEnded 조회수가 발생하면 다시 UIViewController 번을 삭제합니다.상단에 ViewController를 표시 할 때 UITableViewCell의 touchesEnded가 호출되지 않습니다.

그래서 셀을 만질 때 뭔가 보이고 화면을 놓으면 다시 숨 깁니다. 모든 좋은,하지만 빨리 누르면 UITableViewCell 릴리스; 이 경우 touchesEnded이 호출되지 않습니다. 내가 2 초 이상 잡아두면 시스템이 잘 작동합니다. 'touchesCancelled'도 불리지 않습니다.

이 문제에 대한 의견이 있으십니까? 초점이 UITableViewCell에 있기 때문에 새롭게 표시된 UIViewController 또는 기존 UITableViewController의 Touch 메소드는 (내가 손을 뗀 다음 다시 누를 때까지 목적을 상실 할 때까지) 어느 쪽도 치지 않습니다.

관련 코드 :

-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event 
{ 
    [super touchesBegan:touches withEvent:event]; 

    amDisplayingCapture = YES; 
    [self.showCaptureDelegate displayCapture:self.capture]; 
} 

-(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event 
{ 
    [super touchesEnded:touches withEvent:event]; 
    if(amDisplayingCapture) 
    { 
     [self.showCaptureDelegate endDisplayCapture]; 
     amDisplayingCapture = NO; 
    } 
} 

합니다 (UITableViewdidSelectRowAtIndexPath가 호출되지 않습니다 중 하나를 나는 새 UIViewController을 제시, 그래서를 사용할 수 없습니다 번)가 UIResponder 헤더 파일에서

답변

3

을 :

응답자는 처리중인 모든 터치에 대해 touchesEnded:withEvent: 또는 touchesCancelled:withEvent: 중 하나를받습니다. d in touchesBegan:withEvent:). 응용 프로그램에서 올바른 동작을 위해 취소 된 터치를 처리해야합니다. 그렇게하지 않으면 잘못된 행동이나 충돌로 이어질 가능성이 큽니다.

요약 : touchesCancelled:withEvent:도 구현해야합니다.

+0

여기에 더 많은 정보가 있습니다. https://developer.apple.com/library/ios/documentation/uikit/reference/UIResponder_Class/Reference/Reference.html –

+0

고마워요.하지만 제가 언급 했어야 만합니다. Cancelled는 . 내가 기대했던 UITableViewCell과 다른 ViewController에서는 그렇지 않습니다. Began이 호출되지만 트레이스없이 사라지는 것과 같습니다. – Yasper

+0

모든 접촉은 종료되거나 취소되어야합니다. 이러한 방법을 재정의하는 하위 뷰를 사용할 수도 있습니까? –

1

누군가 비슷한 상황이 발생하면 필자는 전체 viewcontroller를 모달로 표현하는 대신 새 viewcontroller의 뷰를 하위 뷰로 추가하여이 문제를 해결했습니다. 그것은 touchesEnded가 호출되게하는 것처럼 보였습니다.

관련 문제