ios – UIImagePickerController – 在摄像机视图中选择已保存的图像

我能够启动UI
ImagePickerController来制作图片:

func selectCamera(){
    if UIImagePickerController.isSourceTypeAvailable(UIImagePickerControllerSourceType.Camera) {
        let imagePicker = UIImagePickerController()
        imagePicker.delegate = self
        imagePicker.sourceType = UIImagePickerControllerSourceType.Camera;
        imagePicker.allowsEditing = true
        self.presentViewController(imagePicker, animated: true, completion: nil)
    }
}

并使用此功能从保存的图片中进行选择:

func selectPicture() {
    let picker = UIImagePickerController()
    picker.allowsEditing = true
    picker.delegate = self
    presentViewController(picker, animated: true, completion: nil)
}

我可以从手机上的图片库中选择一张图片,也可以拍照.

但我想在相机视图中选择一个保存的图库画面,它是如何在标准相机应用程序中.这可能吗?

最佳答案 如果你想在摄像机视图中有Gallery Pics,你必须创建一个自定义cameraOverlay视图,它有一个按钮,然后打开保存的图片.

为了加快速度,您可以使用像 – >这样的库. https://github.com/GabrielAlva/Cool-iOS-Camera

要么

您还可以拥有一个操作表,要求用户选择他想要的选项.

检查一下 – > How to allow the user to pick a photo from his camera roll or photo library?
&安培;这个 – > https://github.com/chroman/CRMediaPickerController

点赞