iPhone UIImagePicker Camera in Landscape Orientation

笑着哭i 提交于 2019-12-12 18:18:03

问题


Is there any good way to set UIImagePicker to landscape orientation? I tried to call setStatusBarOrientation after presentModalViewController like following,

[self presentModalViewController:picker animated:YES];

[[UIApplication sharedApplication] setStatusBarOrientation: UIInterfaceOrientationLandscapeRight animated: NO ];

However, the video duration view (00:00) on the right corner didn't rotate as orientation changed.


回答1:


Unfortunately, according to the documentation, the image picker only supports portrait mode.




回答2:


Apple doesn't support landscape for camera view. If you want anything shown as customised then add overlay view on it & transform that view to look as landscape view. @Note:-overlay is also add as portrait thats why transformation needed.




回答3:


I was able to create landscape camera view using the following code:

[self.view insertSubview:self.imagePicker.view atIndex:0];

self.imagePicker.view.transform =  
    CGAffineTransformScale (
                            CGAffineTransformTranslate(
                            CGAffineTransformMakeRotation(M_PI/2), -90, -15),
                            1.2,1.2)
                            ;

Note that I am directly adding the imagePicker's view to the current view, not calling it as a modal.

self.imagePicker.view.transform seems to respond as expected to all CGAffineTransform function calls, though I can't speak to whether or not Apple approves of this method.



来源:https://stackoverflow.com/questions/1951315/iphone-uiimagepicker-camera-in-landscape-orientation

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