mirror of
https://github.com/jphong1111/awesome-ios-developer.git
synced 2025-07-12 16:59:53 +07:00
edit Image Picker
This commit is contained in:
@ -1,6 +1,5 @@
|
|||||||
//
|
//
|
||||||
// ImagePicker.swift
|
// ImagePicker.swift
|
||||||
// VariousManagerDemoApp
|
|
||||||
//
|
//
|
||||||
// Created by JungpyoHong on 4/21/21.
|
// Created by JungpyoHong on 4/21/21.
|
||||||
//
|
//
|
||||||
@ -24,7 +23,6 @@ open class ImagePicker: NSObject {
|
|||||||
|
|
||||||
self.presentationController = presentationController
|
self.presentationController = presentationController
|
||||||
self.delegate = delegate
|
self.delegate = delegate
|
||||||
|
|
||||||
self.imagePicker.delegate = self
|
self.imagePicker.delegate = self
|
||||||
self.imagePicker.allowsEditing = true
|
self.imagePicker.allowsEditing = true
|
||||||
self.imagePicker.mediaTypes = ["public.image"]
|
self.imagePicker.mediaTypes = ["public.image"]
|
||||||
@ -44,7 +42,6 @@ open class ImagePicker: NSObject {
|
|||||||
public func present(from sourceView: UIView) {
|
public func present(from sourceView: UIView) {
|
||||||
|
|
||||||
let alertController = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet)
|
let alertController = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet)
|
||||||
|
|
||||||
if let action = self.action(for: .camera, title: "Take photo") {
|
if let action = self.action(for: .camera, title: "Take photo") {
|
||||||
alertController.addAction(action)
|
alertController.addAction(action)
|
||||||
}
|
}
|
||||||
@ -56,13 +53,6 @@ open class ImagePicker: NSObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
alertController.addAction(UIAlertAction(title: "Cancel", style: .cancel, handler: nil))
|
alertController.addAction(UIAlertAction(title: "Cancel", style: .cancel, handler: nil))
|
||||||
|
|
||||||
// if UIDevice.current.userInterfaceIdiom == .pad {
|
|
||||||
// alertController.popoverPresentationController?.sourceView = sourceView
|
|
||||||
// alertController.popoverPresentationController?.sourceRect = sourceView.bounds
|
|
||||||
// alertController.popoverPresentationController?.permittedArrowDirections = [.down, .up]
|
|
||||||
// }
|
|
||||||
|
|
||||||
self.presentationController?.present(alertController, animated: true)
|
self.presentationController?.present(alertController, animated: true)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user