I'm using UIImagePickerController for picking images from gallery. Here is the code
let imagePicker = UIImagePickerController()
imagePicker.sourceType = .photoLibrary
imagePicker.allowsEditing = true
imagePicker.delegate = self
self.present(imagePicker, animated: true, completion: nil)
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) {
isfrompicker = true
if let image = info[.editedImage] as? UIImage {
// I'm getting image with black background on right side as shown.
}
}
I'm not sure why I'm getting black background on right side. Same code is working fine on some devices. But I'm getting issue with my iPhone X.
I got the same problem a few ago. Then i found a solution on Link to page
Try adding this line before presenting imagePicker
UINavigationBar.appearance().isTranslucent = true
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.