1

I have a preview layer which shows the camera preview, using AVFoundation. Now I want to start my app such that everything is in landscape mode. How do I do that for the preview layer?

setorientation: method is deprecated for iOS 6 so I don't want to use that.

The setVideoOrientation method of AVCaptureConnection changes the actual way the images are captured but the preview orientation still remains the same.

neeraj
  • 1,191
  • 4
  • 19
  • 47
  • 1
    check this - http://stackoverflow.com/questions/12650137/how-to-change-the-device-orientation-programmatically-in-ios-6 – rishi Oct 26 '12 at 05:18
  • that is for 'device orientation' but still the link is good – neeraj Oct 26 '12 at 05:25
  • do you find a solution for this? I have the same problem. Thanks – A.Vila May 09 '13 at 14:28
  • Apply CGAffineTranformRotate on the view in which you added the preview layer. This changes the visible orientation of the camera preview. The default capture of images is ALWAYS in landscale orientation, with home button on the right. – neeraj May 09 '13 at 18:06

1 Answers1

0

The preview layer has it's own AVCaptureConnection object. Retrieve it, (previewLayer.connection) and then use the setorientation function there. Also, I believe the previewlayer is mirrored as well. You can un-mirror it with the connection object as well.