I have users select an image from the UIImagePickerController and when I access the image afterwards, it has a black bar. Note the image is not cropped, the image picker actually goes beyond the bounds of the image where no pixels exist and adds empty blackspace.
My code:
@IBAction func selectImageButt(_ sender: Any) {
let imagepicker = UIImagePickerController()
imagepicker.allowsEditing = true
imagepicker.sourceType = .photoLibrary
imagepicker.delegate = self
present(imagepicker, animated: true)
}
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) {
if let image = info[UIImagePickerControllerEditedImage] as? UIImage {
testImageView.image = image
}
picker.dismiss(animated: true)
}
The results are as follows:
Note I've tried changing the image view's contentMode to scale to fill as well as aspect fill (not fit). I don't know why the black bars are added as part of the image itself. Can anybody assist?

