2010-07-12 3 views
1

UIApplication에서 beginIgnoringInteractionEvents와 같은 함수가 터치 대신 회전을 무시합니까? 내가 선물하는 MPMovePlayerViewController에서 회전하지 않도록 앱을 필요로합니다.시스템이 iPhone 회전을 무시합니다

감사

[업데이트]

여기 내 코드의

-

MPMoviePlayerViewController *mpViewController = [[MPMoviePlayerViewController alloc] initWithContentURL:[NSURL URLWithString:videoURL]]; 
[mpViewController shouldAutorotateToInterfaceOrientation:UIInterfaceOrientationLandscapeRight]; 
[[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationLandscapeRight animated:NO]; 
[self presentMoviePlayerViewControllerAnimated:mpViewController]; 
[mpViewController release]; 

내가 shouldAutorotateToInterfaceOrientation을 모두 추가하여 작업을 가지고 : 및 setStatusBarOrientation : 방법. 그것은 시뮬레이터에서 작동합니다. 그러나 비디오가 재생되는 동안 iPhone을 회전하면 상태 표시 줄도 회전하고 세로 방향으로 '고정'상태로 유지됩니다. http://i28.tinypic.com/357mrub.png

[UPDATE 2 MPMoviePlayerViewController 서브 클래 싱 (shouldAutorotate 및 방법을 구현)에서

내에서 문제

이미지, 프로그램이 정상적으로 회전한다. 회선이

[self presentMoviePlayerViewControllerAnimated:mpViewController]; 

내 서브 클래스를 허용하지 않기 때문에 비디오 만 재생되지 않습니다.

"경고 : 예상 호환되지 않는 목표 - C 유형 '구조체 NoRotate의 *', '구조체 MPMoviePlayerViewController *'때의 인수 하나를 전달하는 'presentMoviePlayerViewControllerAnimated'뚜렷한 목표 - C 타입에서"

답변

6

보기 당신은 현재, shouldAutoRotate 메소드를 구현하고 단순히 "NO"를 리턴하십시오. 이렇게하면 휴대 전화가 모든 방향 변경을 무시하게됩니다.

+0

일처럼 MPMoviePlayerViewController 하위 클래스 수 있습니다! 덕분에 – jmont

0

은 아마 당신은이 마침내

// NotRotatingMoviePlayerViewController.h 
@interface NotRotatingMoviePlayerViewController : MPMoviePlayerViewController { 
} 

@end 

// NotRotatingMoviePlayerViewController.m 
@implementation 

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation { 
    return (toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft); 
} 

@end 
+0

감사합니다, 그것은 비디오가 재생되지 않습니다 작동합니다. [self presentMoviePlayerViewControllerAnimated : mpViewController]; 경고 :경고 : 'ObjectMagiePlayerViewControllerAnimated :'의 인수 1을 전달할 때 'struct MPMoviePlayerViewController *'와 (와) 호환되지 않는 Objective-C 유형 '구조체 NoRotate *'가 필요합니다 " – jmont

관련 문제