gpt4 book ai didi

ios - 在 UIImagePickerController 之上呈现一个 View Controller ,而不是关闭 UIImagePickerController

转载 作者:行者123 更新时间:2023-11-29 05:37:31 27 4
gpt4 key购买 nike

我正在开发一个应用程序,我必须使用图像选择器 Controller 从手机库导入图像。问题是我必须首先关闭选择器 Controller ,然后在选择器 Controller 关闭后呈现另一个 Controller 。有没有一种方法可以让我不必关闭图像选择器 Controller ,而是呈现 View Controller 或导航 Controller 。顺便说一句,如果我不关闭 imagePickerController,它就会崩溃。其次,我将展示一个传递所选图像的 View Controller 。谢谢。

func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) {

let shViewController = SHViewController()

if let editedImage = info[UIImagePickerController.InfoKey.editedImage] as? UIImage {
shViewController.image = editedImage
} else if let originalImage = info[UIImagePickerController.InfoKey.originalImage] as? UIImage {
shViewController.image = originalImage
}


shViewController.delegate = self

dismiss(animated: true, completion: nil)
present(shViewController, animated: true, completion: nil)
}

最佳答案

你不能从同一个 vc 中呈现 2 个 vc ,所以要么

picker.present(shViewController, animated: true, completion: nil)

dismiss(animated:false) {
self.present(shViewController, animated: true, completion: nil)
}

关于ios - 在 UIImagePickerController 之上呈现一个 View Controller ,而不是关闭 UIImagePickerController,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56891987/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com