我的MPMoviePlayerController视图已添加为另一个视图控制器的子视图。当我在全屏播放视频并翻转模拟器时,视频不会翻转,父视图也不会翻转。然而,当我在旋转方法中添加
以下是我使用的代码:
对于视频:
return YES
(检查下面的代码)时,视频在全屏播放时旋转,正如我想要的那样,但父视图也旋转了,这是我不想要的,因为我没有为父视图设计横向视图。当视频处于全屏状态时,如何只允许视频旋转而不是父视图??以下是我使用的代码:
对于视频:
- (void)viewDidAppear:(BOOL)animated {
NSBundle *bundle=[NSBundle mainBundle];
NSString *moviePath = [bundle pathForResource:@"MainPageMovie" ofType:@"mp4"];
NSURL *movieURL=[[NSURL fileURLWithPath:moviePath] retain];
MPMoviePlayerController *theMovie = [[MPMoviePlayerController alloc] initWithContentURL:movieURL];
theMovie.scalingMode = MPMovieScalingModeAspectFill;
theMovie.view.frame = CGRectMake(115.0, 156.0, 200.0, 150.0);
[self.view addSubview:theMovie.view];
[theMovie play];
[super viewDidLoad];
self.view.backgroundColor = [UIColor viewFlipsideBackgroundColor];
}
对于旋转方法:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations
return YES;
}