如何使用带有上次拍摄图像预览的“选择图像”按钮

时间:2019-02-16 16:55:46

标签: ios swift xcode uiimagepickercontroller

我正在构建一个相机应用程序,并希望将最后拍摄的照片显示为选择照片的按钮。我该怎么办?

现在,我正在使用 UIImagePickerController 选择图像,并使用 UIButton 仅带有文本来调出控制器。

@IBAction func choosePhotoBtnPressed(_ sender: Any) {
    let imagePicker = UIImagePickerController()
    imagePicker.sourceType = .photoLibrary
    imagePicker.mediaTypes = [kUTTypeImage as String, kUTTypeMovie as String]
    imagePicker.delegate = self
    present(imagePicker, animated: true, completion: nil)
}

我希望它看起来像库存相机应用程序。

https://i1.wp.com/9to5mac.com/wp-content/uploads/sites/6/2013/09/screen-shot-2013-09-20-at-9-56-50-am.png?resize=1600%2C1000&quality=82&strip=all

0 个答案:

没有答案