Tocropviewcontroller: Cropping image square

Created on 6 Feb 2019  ·  3Comments  ·  Source: TimOliver/TOCropViewController

  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...?
bug pr requested

Most helpful comment

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.

All 3 comments

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

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.

Was this page helpful?
0 / 5 - 0 ratings