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