kishikawakatsumi / PEPhotoCropEditor

Image cropping library for iOS.
MIT License
1.09k stars 358 forks source link

Just square aspect #3

Closed tuandao closed 11 years ago

tuandao commented 11 years ago

Hi kishikawakatsumi,

Thanks for the awesome control. I just need to always crop image as square size, so when user drag the frame it always square and default frame also square with max width size. Could you show me how, thanks.

Tuan

brockboland commented 11 years ago

I've been trying to figure this one out too, and things aren't working as expected.

brockboland commented 11 years ago

(whoops)

I added some NSLog() calls in setImage: and setAspectRatio:, because I tried setting the ratio in setImage::

[self setAspectRatio:1.0f];

But, the NSLog() call in setAspectRatio: never ran, though the ones in setImage: do. I'm not sure why the call to setAspectRatio: isn't working: I'm not getting any errors or anything.

In any case, I would think that you would need to add a setAspectRatio: method to PECropViewController that would call the same on self.cropView (which is PECropView). But, the first step is to figure out why a straight call to setAspectRatio: is failing.

kishikawakatsumi commented 11 years ago

It is not implemented yet to keep fixed aspect ratio on resizing. I will do my best to implement this feature as soon as possible. Thank you.

kishikawakatsumi commented 11 years ago

Done. 91067dc36fbfc56a3ccacb5ba9e113f2b8867230 Use cropAspectRatio property set to 1.0, and keepingCropAspectRatio property set to YES.

rajapandians commented 10 years ago

Hi,

Its working fine if presentViewController:navigationController animated:YES

BUT if the presentViewController:navigationController animated:NO

this does't works crashes the app with the following log

2014-03-05 20:14:15.263 PEPhotoCropEditor[2932:70b] *\ Terminating app due to uncaught exception 'CALayerInvalidGeometry', reason: 'CALayer position contains NaN: [nan 220.5]

This happens on this line

self.frame = [self cropRectMakeWithResizeControlView:resizeControlView];

Because the frame values are NaN on this scenario

Any solutions?

Thanks.

brockboland commented 10 years ago

Could you open a new issue for that? Since this one is closed, your comment probably won't get the attention it deserves.

rajapandians commented 10 years ago

Opened a issue.

Thanks