From 0c4404e2ce6c6a706d36bf38361a64581f126920 Mon Sep 17 00:00:00 2001 From: Brady Klein Date: Tue, 21 Sep 2021 12:42:58 -0500 Subject: [PATCH] Fixed crash occurring on iPad Air by including an idiom check which changes the alert presentation style if the user is on iPad --- TLPhotoPicker/Classes/TLPhotosPickerViewController.swift | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/TLPhotoPicker/Classes/TLPhotosPickerViewController.swift b/TLPhotoPicker/Classes/TLPhotosPickerViewController.swift index acd99536..d0e64e70 100644 --- a/TLPhotoPicker/Classes/TLPhotosPickerViewController.swift +++ b/TLPhotoPicker/Classes/TLPhotosPickerViewController.swift @@ -649,6 +649,14 @@ extension TLPhotosPickerViewController: UIImagePickerControllerDelegate, UINavig picker.mediaTypes = mediaTypes picker.allowsEditing = false picker.delegate = self + + // if user is on ipad using split view controller, present picker as popover + if UIDevice.current.userInterfaceIdiom == .pad { + picker.modalPresentationStyle = .popover + picker.popoverPresentationController?.sourceView = view + picker.popoverPresentationController?.sourceRect = .zero + } + self.present(picker, animated: true, completion: nil) }