Crop Component Installation Guidelines
Drag the DMCrop folder into your project.
#import "DMCropViewController.h" in your desired views header and add DMCropDelegate to it. #import <UIKit/UIKit.h> #import "DMCropViewController.h" @interface DMCropDemoViewController : UIViewController <DMCropDelegate, UIImagePickerControllerDelegate, UINavigationControllerDelegate> @end
In your implementation (.m) file create the DMCropViewController using initWithImage and set the delegate to self.
DMCropViewController *cropView = [[DMCropViewController alloc] initWithImage:imageView.image]; [cropView setDelegate:self]; [self.navigationController pushViewController:cropView animated:YES];
Implement the delegate method (void)DMCropViewController:(DMCropViewController *)vc didCropImage:(UIImage *)croppedImage to get the returned UIImage.
- (void)DMCropViewController:(DMCropViewController *)vc didCropImage:(UIImage *)croppedImage {[imageView setImage:croppedImage];[self.navigationController popViewControllerAnimated:YES];}
All images are included in the DMCrop/Images folder for you to modify.