2011-01-03 4 views
3

두 번 호출 된 UISwipeGestureRecognize에 문제가 있습니다. 탭이 4 개있는 tabbarcontroller 기반 응용 프로그램을 만들었습니다. 해당 UIViewController 아래에있는 UINavigationController 갖는 각 탭, 거기에 세 번째 탭에서 코드 아래에 impelemented있다. 난 [self.tabBarController setSelectedIndex:0] 제어 라인에 도달 할 때, 그것은 "didSwipeLeft"를 호출 시뮬레이터 와이프 남아 않는UISwipeGestureRecognizer가 두 번 호출 되었습니까?

UISwipeGestureRecognizer *swipeLeft =[[UISwipeGestureRecognizer alloc] 
     initWithTarget:self action:@selector(didSwipeLeft:)]; 
swipeLeft.direction=UISwipeGestureRecognizerDirectionLeft; 
swipeLeft.numberOfTouchesRequired = 1; 
[self.view addGestureRecognizer:swipeLeft]; 
[swipeLeft release]; 

- (void) didSwipeLeft:(UISwipeGestureRecognizer *)sender { 
    NSLog(@"Left.."); 
    if ((sender.state == UIGestureRecognizerStateEnded)) { 
     [self.tabBarController setSelectedIndex:0]; 
    } 
} 

다시 호출 함수 (didSwipeLeft). 제발 도와주세요, 문제를 해결하는 방법, 누군가가 동일한 문제에 직면 해있다. 미리 감사드립니다.

+0

같은 문제가 있습니다! – ToddH

답변

1

UIImagePickerController에서 이런 종류의 문제가 발생했습니다. 정적 정수로 해결합니다. 정적 int 또는 bool을 펀트하고 뷰에서 재설정하면 didSwipeLeft가 설정되고 정적 작업 만 설정됩니다. 희망이 도움이됩니다.

관련 문제