【发布时间】:2011-05-31 14:23:12
【问题描述】:
此要求适用于 iPad。 我有一个 UIView,它在启动视频录制时用作相机覆盖视图。它在 UIImagePickerController 中设置如下。
[self presentModalViewController:pickerController animated:NO];
pickerController.cameraOverlayView =myOwnOverlay;
这是我的要求,即在调用摄像头进行视频录制时,我必须在 UIImagePickerController 中提供自己的叠加层。 我只想将自己的相机覆盖 UIView 锁定为横向模式,以便用户只能在横向模式下录制视频,而不是纵向模式,这也是我的项目要求。 我知道用于 UIViewController 的 shouldAutorotateToInterfaceOrientation。我使用了 "[[UIDevice currentDevice] setOrientation:UIInterfaceOrientationLandscapeRight];" 它,当我启动此相机自己的叠加 UIView 时,它会锁定为横向模式,但是当我旋转设备时,UIView 也会旋转为纵向。我根本不想要人像模式。我试图像下面这样处理这个问题,但它不适用于 UIView。然后我看到这在 UIviewController 中是可能的,但在 UIView 中是不可能的。但是我必须有 UIView 才能进行此相机启动操作。
-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation==UIInterfaceOrientationLandscapeRight || interfaceOrientation==UIInterfaceOrientationLandscapeLeft);
}
请建议我如何为我的 UIView 提供方向锁定解决方案?
谢谢!
【问题讨论】:
标签: ipad