Skip to content

Instantly share code, notes, and snippets.

@NikhilManapure
Last active August 4, 2017 06:34
Show Gist options
  • Select an option

  • Save NikhilManapure/ad39ec5433b7c5436210784bd6296dcc to your computer and use it in GitHub Desktop.

Select an option

Save NikhilManapure/ad39ec5433b7c5436210784bd6296dcc to your computer and use it in GitHub Desktop.
import TOCropViewController
extension EditViewController : TOCropViewControllerDelegate {
func openCrop(image: UIImage) {
let crop = TOCropViewController(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.currentlyCapturedImage = image
})
}
func cropViewController(_ cropViewController: TOCropViewController, didCropToImage image: UIImage, rect cropRect: CGRect, angle: Int) {
self.currentlyCapturedImage = image
cropViewController.dismiss(animated: true, completion: {
//
})
}
func cropViewController(_ cropViewController: TOCropViewController, didFinishCancelled cancelled: Bool) {
cropViewController.dismiss(animated: true, completion: {
// Nothing to do
})
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment