在ios应用程序中以纵向模式锁定UIImagePickerController [英] lock UIImagePickerController in Portrait mode in ios app

查看:101
本文介绍了在ios应用程序中以纵向模式锁定UIImagePickerController的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的IOS应用程序中,当我打开相机时,我在相机视图上放置了一个图像。它在纵向模式下看起来不错。但当它改为横向模式时,它看起来有些奇怪。所以我想在纵向模式下锁定 UIImagePickerController

In my IOS app, when I open the camera I have placed an image over the camera view. It looks good in portrait mode. But when it is changed to landscape mode it looks some odd. So I want to lock the UIImagePickerController in Portrait mode.

以下是我的ui图像选择器控制器代码

Following is my code for ui image picker controller

UIImagePickerController *imgPkr = [[UIImagePickerController alloc] init];
imgPkr.delegate = self;
imgPkr.sourceType = UIImagePickerControllerSourceTypeCamera;

如何在纵向模式下锁定....

How it can be locked in portrait mode....

推荐答案

这不是最好的解决方案,但它确实有效:

This is not the best solution, but it works:

AppDelegate *appDelegate = (AppDelegate *) [[UIApplication sharedApplication] delegate];
[appDelegate.window addSubview:cameraOverlay];
imgPicker.cameraOverlayView = appDelegate.window.superview;

背景上的相机仍在旋转,但您的叠加视图不会。
希望它适合你

The camera on the background still rotates, but your overlay view doesn´t. Hope it works for you

这篇关于在ios应用程序中以纵向模式锁定UIImagePickerController的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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