在横向使用UIImagePickerController

在横向使用UIImagePickerController

本文介绍了在横向使用UIImagePickerController的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个处于横向模式的应用程序,我正在使用 UIImagePickerController 使用iPhone相机拍摄照片,我也希望以横向模式创建照片。

I am creating an app which is in landscape mode and I am using UIImagePickerController to take photos using iPhone camera in it and I want to create it in landscape mode too.

但是正如Apple文档所暗示的那样 UIImagePickerController 不支持横向,所以我该怎么做才能获得所需的功能?

But as the Apple documention suggests UIImagePickerController does not support landscape orientation, so what should I do to get desired functionality?

推荐答案

如果您想在横向模式下使用UIImagePickerController,请使用,而不是:

If you'd like to use UIImagePickerController in landscape mode, use user1673099's answer, but instead of:

- (BOOL)shouldAutorotate
{
    return NO;
}

使用:

- (UIInterfaceOrientationMask)supportedInterfaceOrientations{
    return UIInterfaceOrientationMaskLandscape;
}

然后选择器将以横向模式打开:

and then the picker would open in landscape mode:

但请务必检查部署信息中的肖像:

But make sure you check Portrait in deployment info:

这篇关于在横向使用UIImagePickerController的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-23 03:59