Latest 0.0.4
Homepage https://github.com/jiecao-fm/VPImageCropper
License MIT
Platforms ios 5.0, requires ARC

Installation

Copy Source Files

You can simply copy VPImageCropperViewController.* files into you project.

Using CocoaPods

CocoaPods is a dependency manager for Objective-C, which automates and simplifies the process of using 3rd-party libraries in your projects. See the Get Started section for more details.

Podfile

platform :ios, '6.0'
pod 'VPImageCropper', '~>0.0.3'

Usage

It’s incredibly easy to use this kit. Before present the cropper view controller, you should implement the protocol VPImageCropperDelegate:

// callback when cropping finished
- (void)imageCropper:(VPImageCropperViewController *)cropperViewController didFinished:(UIImage *)editedImage;

// callback when cropping cancelled
- (void)imageCropperDidCancel:(VPImageCropperViewController *)cropperViewController;

Now it’s time to present the image cropper view controller and do some cropping.

// present the cropper view controller
VPImageCropperViewController *imgCropperVC = [[VPImageCropperViewController alloc] initWithImage:portraitImg cropFrame:CGRectMake(0, 100.0f, self.view.frame.size.width, self.view.frame.size.width) limitScaleRatio:3.0];
imgCropperVC.delegate = self;
//you can change the button title and background color
//imgCropperVC.confirmTitle = @"确定";
//imgCropperVC.cancelTitle = @"取消";
//imgCropperVC.btnBgColor = [UIColor clearColor];
[self presentViewController:imgCropperVC animated:YES completion:^{
        // TO DO
}];

Summary

As negligible as it is, I am glad this work could be used in some of the products in our company which is the best part. Anyway, if you are interested enough to have a test. Please refer to the VPImageCropperDemo Project and enjoy the beauty of coding.

Latest podspec

{
    "name": "VPImageCropper",
    "version": "0.0.4",
    "summary": "Used for cropping user portrait.",
    "description": "tttImage cropper like the one in WeChat, used for cropping user portrait.n",
    "homepage": "https://github.com/jiecao-fm/VPImageCropper",
    "license": "MIT",
    "authors": "Shannon",
    "social_media_url": "https://github.com/jiecao-fm",
    "platforms": {
        "ios": "5.0"
    },
    "source": {
        "git": "https://github.com/jiecao-fm/VPImageCropper.git",
        "tag": "0.0.4"
    },
    "source_files": "VPImageCropperDemo/VPImageCropper/**/*.*",
    "requires_arc": true
}

Pin It on Pinterest

Share This