Using UIImagePickerController in landscape orientation

后端 未结 8 703
暗喜
暗喜 2020-11-28 09:55

I am creating an app which is in landscape mode and I am using UIImagePickerController to take photos using iPhone camera in it and I want to create it in lands

8条回答
  •  旧时难觅i
    2020-11-28 10:26

    Here's a version that supports rotation in all interface orientations:

    /// Not fully supported by Apple, but works as of iOS 11.
    class RotatableUIImagePickerController: UIImagePickerController {
    
      override var supportedInterfaceOrientations: UIInterfaceOrientationMask {
        return .all
      }
    }
    

    This way if the user rotates her device, it'll update the picker controller to support the current orientation. Just instantiate as you normally would a UIImagePickerController.

    If you only want to support a subset of orientations, you can return a different value.

提交回复
热议问题