【发布时间】:2014-07-30 19:05:28
【问题描述】:
我有一个表tableviewController。单击其中一个单元格时,下一个 viewController 会打开一个 cam 并使用 AVCaptureVideoPreviewLayer 显示视频。为了支持方向,我添加了这些代码行。
- (NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskAll;
//return UIInterfaceOrientationMaskLandscapeRight;
}
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
duration:(NSTimeInterval)duration
{
[[(AVCaptureVideoPreviewLayer *)[[self previewView] layer] connection] setVideoOrientation:
(AVCaptureVideoOrientation)toInterfaceOrientation];
}
但我想锁定我的第二个视图控制器,它只以横向模式显示视频。如果 iPhone 处于纵向模式,我仍然希望它只显示横向模式。就像在某些游戏中一样,方向是锁定的。
【问题讨论】: