How to switch the live screen camera icons from portrait to landscape mode in iPhone?

牧云@^-^@ 提交于 2020-01-03 01:51:07

问题


I created a custom camera overlay for the live screen camera view and have imported my own custom icons for the camera, flash and flip buttons. Everything looks good in portrait mode, but when I switch the live camera screen to landscape mode, the orientation of the camera stays in portrait mode and shows this in console,

"Error: CGAffineTransformInvert: singular matrix"

I tried using the auto resizing mask, also have tried setting two different frames for the icons in both portrait and landscape mode in didRotateFromInterfaceOrientation method. But none of these are working.

My question is, will the landscape orientation support only the default iPhone camera overlay view or will it also support the custom overlayview.

Here are the screenshots indicating the behaviour of the icons repositioning each other when switched from portrait to landscape mode. I want exactly like this in my custom overlay view.

Edit:

I've made the live screen of my custom camera overlay to change by using the UIDevice Orientation method. But right now, the frame is not resizing when i try to switch from the portrait to landscape mode. So, i just want the entire frame to resize in landscape mode. Also, in this piece of code, if i try to change the value of CAMERA_TRANSFORM_Y,

#define CAMERA_TRANSFORM_X 1
#define CAMERA_TRANSFORM_Y 1.234

  self.picker.cameraViewTransform = CGAffineTransformScale(self.picker.cameraViewTransform, CAMERA_TRANSFORM_X, CAMERA_TRANSFORM_Y);

the size of the overlay view reduces both from the top and bottom margin. But, more size gets reduced from the bottom than from the top margin. I want the overlay size to change uniformly both from the top and from the bottom margin.

This is my sample code,

Sample project

来源:https://stackoverflow.com/questions/15549283/how-to-switch-the-live-screen-camera-icons-from-portrait-to-landscape-mode-in-ip

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