2014-06-26 36 views
0

我使用的是蘋果的示例代碼AVFoundation,在這裏,https://developer.apple.com/library/ios/samplecode/AVCam/AVCam.zip力相機景觀AVFoundation

我已經經歷了很多線程,並與谷歌打我的主意太多,但這樣做沒有幫助。

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,這是我剛纔的問題進行了同樣的錯誤,但與UIImagePickerController然後我決定使用AVFoundation功能。

見(錯誤)的截圖,

enter image description here

它開始執行的照相機在縱向和錯誤的攝像頭預覽。

注意,在代碼中設置方向不會有幫助。這隻會旋轉(錯誤)相機預覽。

任何幫助/建議?

回答

0

確保您的項目同時允許Potrait和風景模式,你不能處理UIImagpickerController只在橫向模式下在iPhone上

通過這個在開發者論壇:

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

重要:UIImagePickerController類僅支持縱向模式。此類旨在按原樣使用,不支持子類。這個類的視圖層次是私有的,不能修改,只有一個例外。您可以將自定義視圖分配給cameraOverlayView屬性,並使用該視圖呈現附加信息或管理攝像頭界面和代碼之間的交互。

+0

感謝您的回答,但我意識到這一點。這就是爲什麼我要切換到AV Foundation框架。無論如何,我也提出了一個問題。僅供您參考,[您可以在此查看](http://stackoverflow.com/questions/24409530/wired-behaviour-of-uiimagepickercontroller-while-capturing-photo)。 – Hemang