iPhone中iOS 7中打开相机时横向模式中的方向问题 [英] Orientation issue in Landscape mode while opening camera in iOS 7 in iPhone

查看:237
本文介绍了iPhone中iOS 7中打开相机时横向模式中的方向问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个仅在横向模式下的应用程序。在我的应用程序中,我从我的一个视图中打开相机。它适用于我的iPad,但在iPhone上它崩溃了。它在iOS 6中运行良好,但应用程序崩溃了iOS 7,仅适用于iPhone。

I am having an app which is only in Landscape Mode. In my app I am opening the Camera from one of my views. It is working well for my iPad but on iPhone it crashes. It is working well in iOS 6 but the app crashes for iOS 7 and only for iPhone.

以下是我的代码。

if([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera])
{

    ipc=[[UIImagePickerController alloc] init ];
    ipc.delegate=self;
    ipc.sourceType=UIImagePickerControllerSourceTypeCamera;
    [self presentViewController:ipc animated:YES completion:nil];
} 
else {
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Desc" message:@"Camera capture is not supported in this device" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
    [alert show];
    [alert release];
}

如何解决这个问题?

当我选择从相机捕捉时它会崩溃。它不会从上面的代码崩溃,但之后它崩溃了以下错误。

It crashes when I select to capture from camera. It doesn't crash from the above code but after that it crashes with below error.

我收到此错误:


由于未捕获的异常'UIApplicationInvalidInterfaceOrientation'而终止应用程序,原因:'支持的方向与应用程序没有共同的方向,并且shouldAutorotate返回YES

Terminating app due to uncaught exception 'UIApplicationInvalidInterfaceOrientation', reason: 'Supported orientations has no common orientation with the application, and shouldAutorotate is returning YES

我的应用程序崩溃了。

此视图上的我的方向代码。

-(BOOL)shouldAutorotate
{
    return YES;
}

-(NSUInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskLandscapeLeft | UIInterfaceOrientationMaskLandscapeRight ;
}


推荐答案

我找到了我的解决方案使用UIImagePickerController链接 iOS7 iPad仅景观应用程序

I found my solution from the link iOS7 iPad Landscape only app, using UIImagePickerController.

它对我来说就像一个魅力。

It worked for me like a charm.

希望它能帮助别人。

感谢您的帮助。

这篇关于iPhone中iOS 7中打开相机时横向模式中的方向问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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