3
我的MPMoviePlayerController视图作为子视图添加到另一个视图控制器的视图。当我全屏播放视频并翻转模拟器时,视频不会翻转,父视图也不会翻转。但是,当我在旋转方法(下面的检查代码)中添加return YES
时,视频在全屏显示时会旋转,但是父视图也会旋转,这是我不想要的,因为我没有设计景观父视图的视图。如何在视频全屏的情况下允许旋转,而不是父视图?如何旋转MPMoviePlayerController视频但不是其超级视图
下面是我使用的代码:
对于视频:
- (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;
}
所以基本上或者我设计了一个父视图的横向视图,这将使我设计整个应用程序的风景视图或保持视频播放的纵向视图吧? :P谢谢:)我会尝试在一个单独的视图添加视频。这应该解决我的问题:) – 2011-04-10 02:07:37