VPImageCropper 0.0.4

VPImageCropper 0.0.4

测试已测试
语言语言 Obj-CObjective C
许可证 MIT
发布最后发布2015年1月

Shannon Chou 维护。



安装

复制源文件

您只需将 VPImageCropperViewController.* 文件复制到项目中即可。

Podfile

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

用法

使用此套件非常简单。在显示裁剪视图控制器之前,您应该实现协议 VPImageCropperDelegate

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

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

现在,您可以展示图像裁剪视图控制器并进行一些裁剪操作了。

// 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
}];

总结

虽然这项工作微不足道,但我很高兴它能被我们公司的一些产品使用,这是最好的部分。无论如何,如果您有兴趣进行测试,请参考 VPImageCropperDemo 项目,并享受代码之美。