アプリケーションで MPMoviePlayerController を使用してビデオを再生しています。私のアプリケーションは縦向きモードでしか動作しません。アプリケーションのビデオを横向きモードでのみ再生する必要があります。だから、誰でも私がこれを行う方法を提案してください。現在、私のビデオはポートレート モードで再生されています。
3154 次
2 に答える
3
これを行うには、クラスをサブクラス化する必要がありますMPMoviePlayerController
。
@interface yourMovie:MPMoviePlayerController
{
}
@end
shouldAutoRotate
実装でメソッドを実装し、ランドスケープモードのみを返す必要があります
@implementation yourMovie
- (BOOL)shouldAutorotate
{
return [[UIDevice currentDevice] orientation] != UIInterfaceOrientationPortrait;
}
@end
yourMovie
そして、代わりにインスタンスを作成する必要がありますMPMoviePlayerController
于 2012-10-22T12:18:15.287 に答える
2
MPMoviePlayerController でこのコードを使用します。
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
[[UIApplication sharedApplication] setStatusBarOrientation: UIInterfaceOrientationLandscapeLeft];
return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft);
}
代わりにUIInterfaceOrientationLandscapeLeft
使用することもできますUIInterfaceOrientationLandscapeRight
...
于 2012-10-22T12:17:58.470 に答える