我刚接触iPhone开发,正在编写我的第一个应用程序。整个应用程序只需要竖屏模式,但播放电影时除外。我正在使用MPMoviePlayerController启动电影,它在竖屏模式下播放。如何强制MPMoviePlayerController在横屏模式下播放所有电影。
我正在使用Xcode 4,并为iOS 4.0及以上版本构建应用程序。我需要在info.plist中输入一些设置,以允许MPMoviePlayerController在横屏模式下播放吗?
这是我用来初始化MPMoviePlayerController的代码:
MPMoviePlayerController *theMovie = [[MPMoviePlayerController alloc] initWithContentURL: url];
[self.view addSubview:theMovie.view];
theMovie.allowsAirPlay=YES;
[theMovie setFullscreen:YES animated:YES];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(myMovieFinishedCallback:) name:MPMoviePlayerPlaybackDidFinishNotification object:theMovie];
[theMovie play];