UIImagePickerController - SourceType相机 - 允许拍摄只纵向方向 [英] UIImagePickerController - SourceType Camera - Allow taking photo only portrait orientation

查看:197
本文介绍了UIImagePickerController - SourceType相机 - 允许拍摄只纵向方向的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想阻止用户在横向拍摄照片,只允许纵向。有没有办法你知道做到这一点?



提前感谢!

解决方案

这里:



1)您希望相机按钮不变为横向(仅指示纵向)。您可以通过自定义控件并拥有自己的相机控制栏。



camController.showsCameraControls = NO; //这将禁用默认控件
camController.cameraOverlayView = controlsView;



2)捕获后修改图像数据



这是一个单调乏味的事情(很多blogposts /



现在将您的图片旋转90度(图像)或基于方向的270度),以使其看起来像肖像。


I want to prevent user from taking photo at the landscape orientation and allow only portrait. Is there a way you know to accomplish this?

Thanks in advance!

解决方案

There are different things to consider here:

1) you want the camera button not to change for Landscape orientation (to indicate Portrait orientation only).You can achieve this by having custom controls and having your own Camera Control Bar.

camController.showsCameraControls = NO; // this will disable the default controls camController.cameraOverlayView = controlsView; // this view shows the required camera button in portrait only way.

2) Modifying the image data after capture

This is a tedious thing (already mentioned in many blogposts/stackoverflow)

UIImagePickerController camera preview is portrait in landscape app

Now rotate your image by 90 degrees (or 270 deg based on orientation) to make it look portrait.

这篇关于UIImagePickerController - SourceType相机 - 允许拍摄只纵向方向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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