简体   繁体   English

支持的方向崩溃iOS7

[英]Supported orientations Crash iOS7

I have portrait only app which do video capturing and some other tasks! 我有只做人像的应用程序,可以进行视频捕获和其他一些任务! everything is working fine, I want to keep app in portrait, but Camera view in landscape only. 一切正常,我想让应用保持纵向,但相机视图仅横向显示。 I have rotated single view test in portrait app by using UIInterfaceOrientationMask but Rotating Camera view caused the Following Crash: 我已经通过使用UIInterfaceOrientationMask旋转了人像应用中的单视图测试,但是旋转相机视图导致了以下崩溃:

Supported orientations has no common orientation with the application, and shouldAutorotate is returning YES'

for further info I m using following line to insert show camera. 有关更多信息,我使用以下行插入放映摄像机。 I insert camera view only when app is in landscape. 我仅在应用程序处于横向时插入相机视图。 I use following line of code to show camera! 我使用以下代码行显示相机!

[self.view insertSubview:imagePicker.view atIndex:0];

any solution/suggestion please? 有什么解决方案/建议吗?

First change your orientation settings to support landscape and portrait. 首先更改方向设置以支持横向和纵向。 Create a UINavigationController category and add this lines. 创建一个UINavigationController类别并添加以下行。 (I assume that your center view controller is a navigation controller) (我假设您的中心视图控制器是导航控制器)

- (BOOL)shouldAutorotate {

    return YES;
}

- (NSUInteger)supportedInterfaceOrientations {

    return UIInterfaceOrientationMaskPortrait;
}

and present your image picker. 并展示您的图像选择器。

Edit: In iOS7 this method is not working. 编辑:在iOS7中此方法不起作用。 I guess the only proper way is creating a layer for camera controls and subclass uiimagepickerview to support landscape only. 我猜唯一正确的方法是为相机控件和uiimagepickerview子类创建一个图层,以仅支持横向。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM