嗨,我目前使用 swift 3,并且在通过委托方法创建圆形裁剪视图控制器时遇到了一些问题。 有人可以向我展示他们这样做的代码以及包含新裁剪图像的调用函数。 非常感谢!
例如@srosman8026
extension YourVC : TOCropViewControllerDelegate {
func openCrop(image: UIImage) {
let crop = TOCropViewController(croppingStyle: .circular, image: image)
crop.delegate = self
present(crop, animated: true, completion: nil)
}
func cropViewController(_ cropViewController: TOCropViewController, didCropToCircleImage image: UIImage, rect cropRect: CGRect, angle: Int) {
cropViewController.dismiss(animated: true, completion: {
self.updatePhoto(image: image)
})
}
func cropViewController(_ cropViewController: TOCropViewController, didFinishCancelled cancelled: Bool) {
cropViewController.dismiss(animated: true, completion: {
})
}
}
是的! @drougojrom是正确的! 感谢那! :)
最好也制作一个 Swift 示例项目......
@TimOliver ,我有一个单独的 swift 项目,一个小项目,仅用于演示。 可以将其上传到单独的存储库或添加到您的项目中。
我可以为此打开一个新问题。
最有用的评论
例如@srosman8026