支持的方向崩溃iOS7 [英] Supported orientations Crash iOS7

查看:91
本文介绍了支持的方向崩溃iOS7的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个只有人像的应用程序,可以执行视频捕获和其他一些任务!一切正常,我想让应用保持纵向,但相机视图仅横向显示.我已经通过使用UIInterfaceOrientationMask在纵向应用程序中旋转了单视图测试,但是旋转相机视图导致了以下崩溃:

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:

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?

推荐答案

首先更改方向设置以支持横向和纵向.创建一个UINavigationController类别并添加此行. (我假设您的中心视图控制器是导航控制器)

First change your orientation settings to support landscape and portrait. Create a UINavigationController category and add this lines. (I assume that your center view controller is a navigation controller)

- (BOOL)shouldAutorotate {

    return YES;
}

- (NSUInteger)supportedInterfaceOrientations {

    return UIInterfaceOrientationMaskPortrait;
}

并显示您的图像选择器.

and present your image picker.

在iOS7中,此方法无效.我猜唯一正确的方法是为相机控件和uiimagepickerview子类创建一个图层,以仅支持横向.

In iOS7 this method is not working. I guess the only proper way is creating a layer for camera controls and subclass uiimagepickerview to support landscape only.

这篇关于支持的方向崩溃iOS7的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆