Search code examples
ioscameraorientationlandscape

Is it possible to force orientation in IOS


Is it possible to have a portrait app that contains several different screens, however when the camera in the app is activated it switches to Landscape view and after the camera is done taking the picture returns back to portrait ?

(I want to force the user to only take landscape pictures).


Solution

  • if you read the https://developer.apple.com/library/ios/documentation/uikit/reference/UIImagePickerController_Class/UIImagePickerController/UIImagePickerController.html

    you'll find out that the uiimagepickercontroller only supports portrait. here is the part from the class reference.

    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 only way would be to create a custom camera overlay method and do it in that method.