TOCropViewController icon indicating copy to clipboard operation
TOCropViewController copied to clipboard

Cropping image square

Open piyushlodaliya opened this issue 6 years ago • 3 comments

  1. Choose a square image and set it to CropViewController with setAspectRatioPreset as square.
  2. 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...?

piyushlodaliya avatar Feb 06 '19 05:02 piyushlodaliya

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

TimOliver avatar Feb 06 '19 13:02 TimOliver

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

piyushlodaliya avatar Feb 08 '19 04:02 piyushlodaliya

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.

AwaisFayyaz avatar Jul 17 '19 11:07 AwaisFayyaz