我正在开发一个iPhone应用程序,它利用了UIImagePickerController的摄像头覆盖视图。然而,我遇到的问题是,当图片拍摄和预览屏幕弹出时,我的覆盖仍然在屏幕上。这看起来很奇怪(图片是旋转的,但不是覆盖层)。因此,我需要做两件事中的一件,这两件事都比我所希望的困难得多:
我知道我可以通过设置showsCameraControls = NO来完成#2 --但是,我目前并不是在创建自己的相机控件,我仍然希望使用默认的控件。这似乎是一个大锤的方法,我需要重新创建一个完美的UI与一个定制的界面,只是为了绕过预览屏幕。
发布于 2020-05-16 14:22:16
我不知道仍然有人跟踪这个问题,但它是有可能的popBack,然后显示/显示另一个屏幕/覆盖,为额外的修剪/裁剪/编辑,当取消回到文件夹与保持相同的滚动水平。
这里的代码片段:
任何时候你想要显示的图像选择器
present(imagePicker, animated: true)然后在采摘结束时(这个问题只发生挑选视频)
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) {
let mediaType = info[UIImagePickerController.InfoKey.mediaType] as! String
if (mediaType == "public.image"){
NSLog("%@", "got image")
}else if (mediaType == "public.movie"){
NSLog("%@", "got movie")
// dismiss(animated: true)
let trimView = storyBoard.instantiateViewController(withIdentifier: "TrimView") as! TrimViewController
trimView.delegate = self
trimView.modalPresentationStyle = .pageSheet
imagePicker.popViewController(animated: false)
imagePicker.present(trimView, animated: true)
}
}通过添加一些额外的委托或编译,您可以在TrimViewController的cancel处理程序中执行以下操作,以便返回到UIImagePickerController选择视图的最后位置
func didFinishTrim() {
imagePicker.dismiss(animated: true)
}希望能帮上忙!
发布于 2013-09-11 22:47:59
据我所知,如果不使用AVFoundation创建您自己的自定义图像选择器,这是不可能的。对这个问题最好的答案是here
https://stackoverflow.com/questions/16416707
复制相似问题