iphonesdk:可以让标准的电影播放器以纵向模式工作吗?

iphonesdk:可以让标准的电影播放器以纵向模式工作吗?,iphone,objective-c,Iphone,Objective C,我试着用 - (BOOL) shouldAutoRotateToInterfaceOrientation(UIInterfaceOrientation)interfaceOrientation { if(interfaceOrientation == UIInterfaceOrientationPortrait) { return YES; } } 但它不会改变标准电影播放器中的任何内容。屏幕自动旋转到横向模式,电影播放器不响应纵向旋转 但是,它与常用的视图控制

我试着用

- (BOOL) shouldAutoRotateToInterfaceOrientation(UIInterfaceOrientation)interfaceOrientation {
    if(interfaceOrientation == UIInterfaceOrientationPortrait) {
        return YES;
    }
}
但它不会改变标准电影播放器中的任何内容。屏幕自动旋转到横向模式,电影播放器不响应纵向旋转

但是,它与常用的视图控制器配合使用。SDK版本为3.1.2


我不打算使用预设的视频方向,如果可能的话,我只需要自动旋转。

您必须创建了扩展到UIViewController的自定义类,并且添加了名为import的框架,然后在委托方法-void moviePlayerLoadStateChanged:NSNotification*通知中,您需要添加以下代码行:

[[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationLandscapeRight animated:NO];

你想用什么?如果您使用MPMoviePlayer,那么这可以相当容易地完成。当然,我使用MPMoviePlayer,但除了setOrientation:UIDeviceOrientationGraphital之外,我在它的参考中没有找到任何合适的方法。在3.2文档中,我发现了一个实例方法shoudAutorotateToInterfaceOrientation,分别用于MPMoviePlayeServiceWController类。它不适用于我正在使用的版本。