我在tabbar应用程序中使用MPMoviePlayerViewController显示视频,视频在纵向模式下播放正常但在横向模式下不旋转 .
相同的代码在没有tabbar的另一个项目中正常工作 .
我试图强制autoresizingmask灵活宽度和flexibleHeight没有成功 .
If i return YES in the shouldAutorotateToInterfaceOrientation the status bar rotates but not the movie interface.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations
return YES;
}
-(IBAction) showFamilleMovie {
NSString *videoURL = [[NSBundle mainBundle]
pathForResource:@"film1"
ofType:@"mp4"];
MPMoviePlayerViewController* theMoviePlayer = [[MPMoviePlayerViewController alloc] initWithContentURL:[NSURL fileURLWithPath:videoURL]];
theMoviePlayer.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
[self presentMoviePlayerViewControllerAnimated:theMoviePlayer];
}
你知道项目的来源吗?
谢谢,文森特
2 回答
你可以试试:
这应该允许MoviePlayer旋转 .
我有同样的问题,代码杀手就是我的appDelegate代码中添加了一个视图 . 它没有让玩家正确旋转 .
我的问题是:要实现FBConnect库,您需要在appDelegate中添加一个视图,以获取您正在使用handleOpenURL方法的FB控制器类的对象(当auth完成时从Safari返回)并控制回调 . 我花了一个小时,直到我意识到这个视图阻止了旋转 .
顺便说一下,不关心标签栏 . 即使您没有添加shouldAutorotateToInterfaceOrientation方法,播放器也应该正确旋转 .