[업데이트]아이폰 MPMoviePlayerViewController
으로 내가 모든 방향을 지원하기 위해 모든 부모 뷰 컨트롤러를 변경 추천되었다. 내 응용 프로그램 구조는 다음과 같습니다 : AppDelegate> RootViewController> 비디오> VideoDetails> MPMoviePlayerViewController.
모든 방향을 지원하도록 동영상을 모두 변경하면 동영상이 가로로 재생됩니다. 그러나 모든 방향을 지원하는 것은 내가 원하는 것이 아니며 다른 문제를 야기합니다. 내가 할 수있는 일이나 다른 일이 있습니까?
덕분에
[/ 업데이트]
나는 MPMoviePlayerViewController의 사용자 지정 하위 클래스를 사용하여 비디오를 표시하는 세로 기반의 아이폰 앱이 있습니다. 사용자 프레스 내가이 클래스의 인스턴스를 만들고 재생하고 모달을 제시하면 다음과 같이
- (IBAction) playPressed:(id)sender {
NSString *filepath = [[NSBundle mainBundle] pathForResource:self.currentVideoModel.videoFileName ofType:@"m4v"];
NSURL *fileURL = [NSURL fileURLWithPath:filepath];
// MovieViewController is just a simple subclass of MPMoviePlayerViewController
self.moviePlayerController = [[MovieViewController alloc] initWithContentURL:fileURL];
// full screen code.
[self.moviePlayerController.moviePlayer setScalingMode:MPMovieScalingModeFill];
[self.moviePlayerController.moviePlayer setFullscreen:TRUE];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(moviePlaybackComplete:) name:MPMoviePlayerPlaybackDidFinishNotification object:self.moviePlayerController];
[self presentMoviePlayerViewControllerAnimated:self.moviePlayerController];
}
문제는 세로 잘한다는 것을하지만 난 가로로 아이폰을 켤 때 비디오는 여전히 세로 연극 하지 풍경 :(응용 프로그램의 모든 뷰 컨트롤러는 세로 방향을 지원
내 MPMoviePlayerViewController 서브 클래스는 방향 변경을 허용하기 위해 다음과 같은 방법을 무시하지하지만 더는 영향을했습니다.
- (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation {
return (toInterfaceOrientation == UIInterfaceOrientationPortrait || toInterfaceOrientation == UIInterfaceOrientationLandscapeRight || toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft);
}
심지어했습니다프로그래밍 방식으로 동영상을 회전하려했지만 절대 운이없는 경우 항상 세로 모드로 유지됩니다.
- (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation {
if (toInterfaceOrientation == UIInterfaceOrientationLandscapeRight) {
[self.view setTransform:CGAffineTransformMakeRotation(M_PI/2)];
return true;
}
else if (toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft) {
[self.view setTransform:CGAffineTransformMakeRotation(M_PI * 2)];
return true;
}
else if (toInterfaceOrientation == UIInterfaceOrientationPortrait) {
[self.view setTransform:CGAffineTransformIdentity];
return true;
}
else return false;
}
회전 지원은 * heirarchical입니다. 따라서 무비 플레이어 컨트롤러를 제공하고 회전시키지 않으면 첫 번째 디버깅 단계는 동영상 플레이어로 연결되는 모든 뷰 컨트롤러를 'shouldAutorotate ..'메서드로 검사하여 'YES'를 반환하는 것입니다. '(나중에 불편 함을 덜어주기를 원한다면 점진적으로이 작업을 수행 할 수 있습니다).그런 다음 초상화로 잠길 때까지 한 번에 하나씩 초상화로 전환하고 자신의 회전을 시도 할 때 'UIKit'이 어떤 것인지 확인합니다. 거기서가. – darvids0n
@ darvids0n 감사합니다. 나는 다른 어떤 견해가 초상화 이외의 무엇이라도 지원하는 것을 정말로 원하지 않는다. 그러나 나는 그것이 시도 할 것이고, 무엇이 일어나는 지 알 것이다. – bennythemink
@ darvids0n 내 질문을 업데이트했습니다. 네가 제안 할 수 있는게있어? 조언을 많이 주셔서 감사합니다. – bennythemink