我希望我的视图控制器保持纵向,并且我希望我的子视图能够根据设备的方向旋转。我怎样才能做到这一点?我在子视图中有一个 MPMoviePlayerController,我希望能够以横向观看视频,但我希望我的主视图控制器始终保持纵向。我已经在许多应用程序上看到了这一点,我只是无法在任何地方找到答案。
这是我的代码。
-(IBAction)playMovie:(id)sender{
NSURL *fileURL = [NSURL URLWithString:@"http://www.thebasementonline.com/btv/NicoSmall.mov"];
MPMoviePlayerController *moviePlayerController = [[MPMoviePlayerController alloc] initWithContentURL:fileURL];
[[AVAudioSession sharedInstance] setDelegate: self];
NSError *setCategoryError = nil;
[[AVAudioSession sharedInstance] setCategory: AVAudioSessionCategoryPlayback error: &setCategoryError];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(moviePlaybackComplete:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:moviePlayerController];
[self.view addSubview:moviePlayerController.view];
moviePlayerController.fullscreen = YES;
[moviePlayerController play];
}