我有一个应用程序可以在用 Angular 6 编码的 webview 上加载一个微应用程序。 这个微应用有一个按钮可以通过以下操作上传照片:
<input type="file" accept="image/*" class="hidden" (change)="readInputImage($event)">
它将显示一个操作表,让用户选择从相机或照片库上传。
完成选择图片后,选择器将关闭,只显示黑屏。
有没有办法让我访问 imagepicker
以便我可以更改 modalpresentationstyle
? (因为我怀疑呈现风格应该是overFullScreen
或者你们知道关于此的任何其他解决方案吗?
最佳答案
你能用 webview 在你的类里面试试这个吗? 它将检测下一个 vc 是否为 UIImagePickerController 并将覆盖其 modalPresentationStyle
override func present(_ viewControllerToPresent: UIViewController, animated flag: Bool, completion: (() -> Void)? = nil) {
if viewControllerToPresent is UIImagePickerController {
viewControllerToPresent.modalPresentationStyle = .overFullScreen
}
super.present(viewControllerToPresent, animated: flag, completion: completion)
}
关于ios - 在 Angular 6 微应用中选取图像后,ImagePicker 关闭到黑屏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52148422/