Skip to content
This repository was archived by the owner on Jun 30, 2020. It is now read-only.

Commit 680b6a2

Browse files
author
Christian Compton
authored
Merge pull request #46 from craigkj312/master
Fixing CoreML Vision Simple crash on iPad when opening action sheet.
2 parents a05b054 + dda85f0 commit 680b6a2

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Core ML Vision Simple/Core ML Vision Simple/ImageClassificationViewController.swift

+6
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,12 @@ class ImageClassificationViewController: UIViewController {
109109
photoSourcePicker.addAction(takePhoto)
110110
photoSourcePicker.addAction(choosePhoto)
111111
photoSourcePicker.addAction(UIAlertAction(title: "Cancel", style: .cancel, handler: nil))
112+
113+
if let popoverController = photoSourcePicker.popoverPresentationController {
114+
popoverController.sourceView = self.view
115+
popoverController.sourceRect = CGRect(x: self.view.bounds.midX, y: self.view.bounds.midY, width: 0, height: 0)
116+
popoverController.permittedArrowDirections = []
117+
}
112118

113119
present(photoSourcePicker, animated: true)
114120
}

0 commit comments

Comments
 (0)