2011-01-27 3 views
1

보기 컨트롤러에서 한보기를 다른보기로 전환하는 잘못된 접근법이있을 수 있지만 결국 버그는 결국보기가 계속 사라지는 동안 감지 할 수 있다는 것입니다.모든 터치 감지를 전역 적으로 중지 하시겠습니까?

프로그램에서 전역 적으로 손쉽게 감지를 중지하도록 지시 할 수있는 방법이 있습니까?

- 또는

나 다른 하나 개의보기에서 페이드하기위한 더 좋은 방법이 있나요? 나는 효과가 필요하기 때문에 이전보기의 그림을 캐시 할 수있는 방법이있을 것으로 기대 했었지만 실제로는 활성화 할 필요가 없습니다!

지금 뷰 컨트롤러 메소드가 호출되고

, gotoIntro :

- (void)gotoIntro { 

NSLog(@"switch to intro"); 

[UIView beginAnimations:nil context:NULL]; { 
    [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut]; 
    [UIView setAnimationDuration:.5]; 
    [UIView setAnimationDelegate:self]; 


    for(UIView *v in [containerView subviews]) { 
     v.alpha = 0; 
     v.frame = CGRectMake(0, 0, 1024, 768); 
     [UIView setAnimationDidStopSelector:@selector(removeView:finished:context:)]; 
    } 

MainMenu *mainMenu = [[MainMenu alloc] init]; 
mainMenu.frame = CGRectMake(0, 0, 1024, 768); 
[containerView insertSubview:mainMenu atIndex:0]; 
[mainMenu release]; 



} 

[UIView commitAnimations]; 

} - (무효) removeView (는 NSString *) 완료 animationID (의 NSNumber *) 완료 콘텍스트 (무효 *) 문맥 { NSLog (@ "VIEW REMOVED"); [[self.view.subviews objectAtIndex : 1] removeFromSuperview]; }

이전보기는 색인 1로 설정되어 있는데, 그렇게하지 않아도됩니다. 미안하지만 나머지 코드는 상자에 넣을 수 없습니다. 스택 오버플로가 손상되었습니다.

답변

3

[[UIApplication sharedApplication] beginIgnoringInteractionEvents]endIgnoringInteractionEvents으로 각각 전화하십시오.

1

이 라인은 ... 당신을 도와

self.view.userInteractionEnabled = NO; 
self.view.multipleTouchEnabled = NO; 
self.view.exclusiveTouch = NO; 

응원합니다 ..

+0

감사뿐만 아니라 알고 좋은 것을! 슈퍼 유용한 .. – VagueExplanation

관련 문제