我正在展示一个在其中播放视频的视图控制器 .
当我点击按钮时,视频播放器视图将从故事板启动,其代码如下:
_moviePlayer = [self.storyboard instantiateViewControllerWithIdentifier:@"videoPlayerController"];
[_moviePlayer.view setFrame:self.view.bounds];
[_moviePlayer playMoviesForItems:shopItems];
[self presentViewController:_moviePlayer animated:NO completion:^{
[self.scrollView scrollRectToVisible:CGRectZero animated:YES];
}];
但是方向转向像这样的肖像:
我在下面编写代码但不起作用:
- (BOOL) shouldAutorotateToInterfaceOrientation: (UIInterfaceOrientation)toInterfaceOrientation
{
return UIInterfaceOrientationIsLandscape(toInterfaceOrientation);
}
-(NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskLandscape;
}
iPad没有问题 . 问题出在iPhone上 .
更新:
支持的方向是:
我哪里错了?
3 回答
尝试应用转换并缩放它
使用preferredInterfaceOrientationForPresentation方法 . 希望它会有所帮助 .
请放下面的方法..我会帮你的