title: UIImagePicker opens Photos app in Landscape Mode always
body: <p>UIImagePicker is always opening photos app in landscape mode while the controller is in portrait mode, and the device orientation is also portrait. Can anyone please help?</p>
  
  <p><a href="https://i.stack.imgur.com/r8GJH.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/r8GJH.png" alt="enter image description here"></a></p>
  
  <pre><code>func actionSheet(_ actionSheet: UIActionSheet, didDismissWithButtonIndex buttonIndex: Int) {
  
      if buttonIndex == 1 {
  
          if UIImagePickerController.isSourceTypeAvailable(UIImagePickerControllerSourceType.camera) {
  
              let controller = UIImagePickerController.init()
              controller.sourceType = UIImagePickerControllerSourceType.camera
              controller.delegate = self
              controller.allowsEditing = true
              self.present(controller, animated: true, completion: { () -&gt; Void in
  
              })
          }
      }
      else if buttonIndex == 2 {
  
          let controller = UIImagePickerController.init()
          controller.sourceType = UIImagePickerControllerSourceType.photoLibrary
          controller.delegate = self
          controller.allowsEditing = true
          self.present(controller, animated: true, completion: { () -&gt; Void in
  
          })
      }
  }
  </code></pre>