Swift中的圆形图像选择器

时间:2018-10-21 15:31:59

标签: swift uiimage uiimagepickercontroller

如何在我的应用程序中实现圆形ImagePicker?

这是一个使这成为可能的库,但我不知道Objective-C: https://github.com/ruslanskorb/RSKImageCropper

我当前的代码:

var selectedImage:UIImage?

func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) {
    if let editImage = info["UIImagePickerControllerEditedImage"] as? UIImage {
        profilImageView.image = editImage
        selectedImage = editImage

    } else if let originalImage = info["UIImagePickerControllerOriginalImage"] as? UIImage {
        profilImageView.image = originalImage
        selectedImage = originalImage
    }
    dismiss(animated: true, completion: nil)
}

0 个答案:

没有答案