我在我的应用程序中使用 MPMoviePlayerController 来播放视频。我的应用程序仅在纵向模式下工作。我希望应用程序视频只能在横向模式下播放。所以请任何人建议我如何做到这一点。现在我的视频正在纵向模式下播放。
最佳答案
为此,您需要子类化 MPMoviePlayerController
类。
@interface yourMovie:MPMoviePlayerController
{
}
@end
并且需要在实现中实现shouldAutoRotate
方法,并且只返回横屏模式
@implementation yourMovie
- (BOOL)shouldAutorotate
{
return [[UIDevice currentDevice] orientation] != UIInterfaceOrientationPortrait;
}
@end
并且您需要创建 yourMovie
实例而不是 MPMoviePlayerController
关于iphone - MPMoviePlayerController 应该只在横向模式下,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13011266/