Tocropviewcontroller: Método de delegado rápido

Creado en 8 jul. 2017  ·  3Comentarios  ·  Fuente: TimOliver/TOCropViewController

Hola, actualmente estoy en Swift 3 y tengo algunos problemas para crear un controlador de vista de recorte circular a través del método delegado. ¿Alguien puede mostrarme su código para hacerlo junto con las funciones llamadas que contienen la imagen recién recortada? ¡Muchas gracias!

question

Comentario más útil

@ srosman8026 , por ejemplo

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: {

        })
    }
}

Todos 3 comentarios

@ srosman8026 , por ejemplo

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: {

        })
    }
}

¡Sí! ¡@drougojrom tiene razón! ¡Gracias por eso! :)

También podría ser mejor hacer un proyecto de ejemplo de Swift ...

@TimOliver , tengo el proyecto

Puedo abrir una nueva edición para eso.

¿Fue útil esta página
0 / 5 - 0 calificaciones