简体   繁体   中英

force camera to landscape with AVFoundation

I'm using the Apple's sample code for AVFoundation, here, https://developer.apple.com/library/ios/samplecode/AVCam/AVCam.zip

I've go through the many threads and beat my mind with google too but that doesn't help.

iPhone AVFoundation camera orientation

iOS AVFoundation Video Capture Orientation Options

Force camera view in landscape with orientation lock on

Orientation deprecated in iOS 6

Wired behaviour of UIImagePickerController while capturing photo this was my previous question for the same error but with UIImagePickerController then I decide to use AVFoundation functions.

See the (error) screenshot,

在此处输入图片说明

It started the camera in portrait and wrong camera preview.

Note, setting orientation in code doesn't help. That only rotated (wrongly) camera preview.

Any help/suggestion?

Make sure that your project allows both Potrait and Landscape mode, You can't handle the UIImagpickerController only in landscape mode on iPhone

go through this in Developer forum:

https://developer.apple.com/library/ios/documentation/uikit/reference/UIImagePickerController_Class/UIImagePickerController/UIImagePickerController.html#//apple_ref/doc/uid/TP40007070-CH3-DontLinkElementID_1

Important: The UIImagePickerController class supports portrait mode only. This class is intended to be used as-is and does not support subclassing. The view hierarchy for this class is private and must not be modified, with one exception. You can assign a custom view to the cameraOverlayView property and use that view to present additional information or manage the interactions between the camera interface and your code.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM