ムービーが再生されていない限り、回転を許可しないアプリで作業しています。私はアプリを回転させても問題ありませんが、映画を見ようとすると問題が発生します。iPhoneムービーローテーションのみサブビュー
シミュレータは強制的に回転しますが、ムービーは回転しません。この例は以下の通りです:
私も映画を回転させる方法を見つけ出すことはできません。私は、サブビューのみを回転させたいと考えています。私のコードは以下の通りです:
MPMoviePlayerController *moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL URLWithString:finalURL]];
if ([moviePlayer respondsToSelector:@selector(setFullscreen:animated:)]) {
// Use the 3.2 style API
moviePlayer.controlStyle = MPMovieControlStyleDefault;
moviePlayer.shouldAutoplay = YES;
[self.view addSubview:moviePlayer.view];
[moviePlayer setFullscreen:YES animated:YES];
[[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationLandscapeRight animated:NO];
// Rotate the view for landscape playback
[[moviePlayer view] setBounds:CGRectMake(0, 0, 480, 320)];
[[moviePlayer view] setCenter:CGPointMake(160, 240)];
[[moviePlayer view] setTransform:CGAffineTransformMakeRotation(M_PI/2)];
// Set frame of movieplayer
[[moviePlayer view] setFrame:CGRectMake(0, 0, 480, 320)];
} else {
// Use the 2.0 style API
moviePlayer.movieControlMode = MPMovieControlModeHidden;
[moviePlayer play];
}
}
EDIT:私は[moviePlayer setOrientation UIInterfaceOrientationLandscapeRight];
を試みたが、コンパイラは私にエラーを与え、何も
呼び出すことによって、ビューコントローラからMPMoviePlayerControllerを取得するには、あなたが実際のデバイス上でテストがありますか? – Dancreek
はい、同じことをします。 –