sol*_*eil 6 mpmovieplayercontroller uiinterfaceorientation ios
我的应用程序支持的界面方向是纵向和上下颠倒.但是,播放视频时,我希望它能够播放全屏风景.目前使用此代码,即使设备旋转,它也只播放肖像:
[player.moviePlayer setControlStyle:MPMovieControlStyleFullscreen];
player.view.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
[self presentMoviePlayerViewControllerAnimated:player];
Run Code Online (Sandbox Code Playgroud)
如何强制它进入横向模式?
Wal*_*ter 11
我是这样做的:
在项目文件中,确保您支持横向方向

现在,在所有仍应为Portrait Only的ViewControllers中,添加此代码
//ios6
- (BOOL)shouldAutorotate {
return NO;
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
return UIInterfaceOrientationPortrait;
}
- (NSUInteger)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskPortrait;
}
//ios4 and ios5
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
Run Code Online (Sandbox Code Playgroud)
我已经同时进行了iOS5和iOS6调用,以便我的代码可以同时运行.
当您的MPMoviePlayerController视图变为全屏时,它将是一个新的ViewController,在其他所有内容之上.因此,将允许根据项目的"支持的接口方向"进行旋转.它不会看到你强迫其他ViewControllers进入Portrait的位置.
| 归档时间: |
|
| 查看次数: |
4969 次 |
| 最近记录: |