how to change the UIImagePickerController crop frame

∥☆過路亽.° 提交于 2019-11-28 06:49:39

You have to implement it your self.

The picker only performs 320x320 cropping.

So instead set

allowsImageEditing = NO;

Now you will get the full image back. Then you will have to create a view/view controller that will crop to the proportions you desire.

Tim

This is the more recent answer with the necessary manual cropping code: Manual Crop

There is still no escaping the hard work.

You can try ShittyImageCrop. It's good for cropping to a specific aspect ratio. In your case, present it with aspect ratio 4:3 (or 3:4 in landscape) like this:

let cropVC = ShittyImageCropVC(frame: (self.navigationController?.view.frame)!, image: imageToCrop, aspectWidth: 4, aspectHeight: 3)
self.navigationController?.present(cropVC, animated: true, completion: nil)

After that you can use some other code to just scale it to desired resolution (320x240 or 240x320).

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!