Как мне добиться чего-то подобного?
Сейчас я использую стандарт UIImagePickerController
, как показано ниже, но это довольно скучно и не очень хороший пользовательский опыт.
Стандартное представление:
// MARK: ImagePickerController
extension MainViewController: ImagePickerDelegate, UIImagePickerControllerDelegate, UINavigationControllerDelegate {
// delegate function
func showImagePickerControllerActionSheet() {
// choose Alert Options
let photoLibraryActionn = UIAlertAction(title: "Aus Album wählen", style: .default) { (action) in
self.showImagePickerController(sourceType: .photoLibrary)
}
let cameraAction = UIAlertAction(title: "Foto aufnehmen", style: .default) { (action) in
self.showImagePickerController(sourceType: .camera)
}
let cancelAction = UIAlertAction(title: "Zurück", style: .cancel, handler: nil)
AlertService.showAlert(style: .actionSheet, title: "Wähle ein Bild aus", message: nil, actions: [photoLibraryActionn, cameraAction, cancelAction], completion: nil)
}
func showImagePickerController(sourceType: UIImagePickerController.SourceType) {
let imagePickerController = UIImagePickerController()
imagePickerController.delegate = self
imagePickerController.allowsEditing = true
imagePickerController.sourceType = sourceType
present(imagePickerController, animated: true, completion: nil)
}
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) {
if let editedImage = info[UIImagePickerController.InfoKey.editedImage] as? UIImage {
makeWishView.wishImageView.image = editedImage
makeWishView.wishImageButton.titleLabel?.text = ""
} else if let originalImage = info[UIImagePickerController.InfoKey.originalImage] as? UIImage {
makeWishView.wishImageButton.titleLabel?.text = ""
makeWishView.wishImageView.image = originalImage
}
dismiss(animated: true, completion: nil)
}
}
Я ничего не могу найти по этому поводу, рад за любую помощь!