CocoaPods trunk is moving to be read-only. Read more on the blog, there are 7 months to go.

ASMCropViewController 0.1

ASMCropViewController 0.1

TestsTested
LangLanguage Obj-CObjective C
License MIT
ReleasedLast Release Dec 2014

Maintained by Andy Molloy.




  • By
  • Andy Molloy

Provides yet another UI for cropping images in iOS. Similar to the UI crop UI in the built in Photos app, but without the auto-zooming behavior.

License

MIT License.

Installation

Usage

ASMCropImageViewController* controller = [[ASMCropImageViewController alloc] init];
controller.image = [UIImage imageNamed:@"IMG_7999.jpg"];

UINavigationController* navController = [[UINavigationController alloc] initWithRootViewController:controller];
[self presentViewController:navController animated:YES completion:NULL];

By default, the crop frame is not constrained to any aspect ratio. You can change that without

controller.aspectRatio = CGSizeMake(9, 16);

To go back to unconstrained, just set aspectRatio to CGSizeZero.

Getting the cropped image

UIImage* croppedImage = [controller croppedImage];

This can be called at any time after the view has been presented, and can be called as often as you'd like.

Notes

This is currently barely tested and has not been used in any production code. You have been warned!