TOCropViewController
TOCropViewController copied to clipboard
Cropping image square
- Choose a square image and set it to CropViewController with setAspectRatioPreset as square.
- I choose a square aspect ratio from the aspect ratio button. 3. The frame which is generated is not actually square. Can I have a solution for these...?
Hi!
Sounds like a bug! Please attach the image, and paste the code you used to present the view controller.
I don't have time to maintain this right now. All PRs are welcome. :D
func CropViewController(imagePosted : UIImage) {
let image: UIImage = imagePosted
let cropViewController = CropViewController(image: image)
cropViewController.delegate = self
cropViewController.setAspectRatioPreset(.presetSquare, animated: true)
self.navigationController?.pushViewController(cropViewController, animated: false)
}
The image which I had selected is as below:
I am using this code. i wanted the cropped image to be square only and its working perfectly fine.
cropVC = TOCropViewController.init(image: image) cropVC.delegate = self cropVC.setAspectRatioPresent(.presetSquare, animated: true) cropVC.aspectRatioLockEnabled = true present(AccountSettingsVC.cropVC, animated: true, completion: nil
Thanks Tim Oliver. Save me a lot of development Time.