UIImagePickerController - SourceType Camera - Allow taking photo only portrait orientation

醉酒当歌 提交于 2019-12-25 12:04:36

问题


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!


回答1:


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.



来源:https://stackoverflow.com/questions/6203428/uiimagepickercontroller-sourcetype-camera-allow-taking-photo-only-portrait-o

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!