# CropImage **Repository Path**: leeszi/CropImage ## Basic Information - **Project Name**: CropImage - **Description**: No description available - **Primary Language**: Objective-C - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2016-04-22 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # CropImage [![CI Status](http://img.shields.io/travis/liuzhen/CropImage.svg?style=flat)](https://travis-ci.org/liuzhen/CropImage) [![Version](https://img.shields.io/cocoapods/v/CropImage.svg?style=flat)](http://cocoapods.org/pods/CropImage) [![License](https://img.shields.io/cocoapods/l/CropImage.svg?style=flat)](http://cocoapods.org/pods/CropImage) [![Platform](https://img.shields.io/cocoapods/p/CropImage.svg?style=flat)](http://cocoapods.org/pods/CropImage) ## Usage To run the example project, clone the repo, and run `pod install` from the Example directory first. ## Requirements 支持iOS7.0及以上版本 ## Installation CropImage is available through [CocoaPods](http://cocoapods.org). To install it, simply add the following line to your Podfile: ```ruby pod "CropImage" ``` ## Example ### 直接使用 ```objective-c CropViewController *crop = [[CropViewController alloc] init]; crop.cropImage = ^(UIImage *image) { self.imageView.image = image; [self dismissViewControllerAnimated:YES completion:nil]; }; crop.editImage = image;//image为要编辑的原图 ``` ### 与UIImagePickerController配合使用 首先正常的弹出UIImagePickerController,然后再选择图片的回调中,实现以下代码 ```objective-c - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info { CropViewController *crop = [[CropViewController alloc] init]; crop.hwRation = 1./2.; crop.cropImage = ^(UIImage *image) { self.imageView.image = image; [self dismissViewControllerAnimated:YES completion:nil]; }; crop.editImage = info[UIImagePickerControllerOriginalImage]; [picker pushViewController:crop animated:YES]; } ``` ## Author liuzhen, lazy66@me.com ## License CropImage is available under the MIT license. See the LICENSE file for more info.