【发布时间】:2011-09-19 06:36:59
【问题描述】:
我有一个带有嵌入视频的纵向视图。将方向更改为横向时,MPMovieplayerController 成功切换到全屏,但当更改回纵向时,它仍处于全屏模式。导航栏为旋转动画闪烁,但视频保持(纵向)全屏模式。
我错过了什么吗?
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
m_player = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL URLWithString:self.selectedVideo.videoHighURL ]];
m_player.scalingMode = MPMovieScalingModeAspectFit;
m_player.controlStyle = MPMovieControlStyleFullscreen;
m_player.view.frame = m_videoView.frame;
[m_videoView addSubview:m_player.view];
[m_player play];
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
}
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{
switch (toInterfaceOrientation) {
case UIInterfaceOrientationPortraitUpsideDown:
break;
case UIInterfaceOrientationLandscapeLeft:
case UIInterfaceOrientationLandscapeRight:
if (NO == m_player.fullscreen) {
[m_player setFullscreen:YES animated:YES];
}
break;
case UIInterfaceOrientationPortrait:
[m_player setFullscreen:NO animated:YES];
break;
default:
break;
}
}
提前致谢!
【问题讨论】:
-
你能帮我解决类似的问题吗?参考stackoverflow.com/questions/7581435/…
标签: orientation mpmovieplayercontroller fullscreen