[翻译] RSKImageCropper

RSKImageCropper

https://github.com/ruslanskorb/RSKImageCropper

An image cropper for iOS like in the Contacts app with support for landscape orientation.

一个iOS图片裁剪器,支持横竖屏切换.

Installation - 安装

CocoaPods is the recommended method of installing RSKImageCropper. Simply add the following line to your Podfile:

Podfile

pod 'RSKImageCropper'

Basic Usage - 基本用法

Import the class header.

包含头文件.

#import "RSKImageCropViewController.h"

Just create a view controller for image cropping and set the delegate.

创建一个图片的控制器,并在代理方法中执行裁剪操作.

- (IBAction)onButtonTouch:(UIButton *)sender { UIImage *image = [UIImage imageNamed:@"image"]; RSKImageCropViewController *imageCropVC = [[RSKImageCropViewController alloc] initWithImage:image]; imageCropVC.delegate = self; [self.navigationController pushViewController:imageCropVC animated:YES]; } 

Delegate - 代理

RSKImageCropViewControllerDelegate provides two delegate methods. To use them, implement the delegate in your view controller.

RSKImageCropViewControllerDelegate提供了两个代理方法.你需要在你的控制器中实现代理方法.

@interface ViewController () <RSKImageCropViewControllerDelegate> 

Then implement the delegate functions.

然后,实现代理方法.

// Crop image has been canceled.
- (void)imageCropViewControllerDidCancelCrop:(RSKImageCropViewController *)controller { [self.navigationController popViewControllerAnimated:YES]; } // The original image has been cropped. - (void)imageCropViewController:(RSKImageCropViewController *)controller didCropImage:(UIImage *)croppedImage { self.imageView.image = croppedImage; [self.navigationController popViewControllerAnimated:YES]; } 

Coming Soon - 将要实现的功能

  • Add more cropping guides. 支持更多的裁剪类型
  • If you would like to request a new feature, feel free to raise as an issue. 如果你有着奇葩的想法,你可以提出来哦,亲^_^!

Demo - 应用示例

Build and run the RSKImageCropperExample project in Xcode to see RSKImageCropper in action. Have fun. Fork and send pull requests. Figure out hooks for customization.

编译以及运行RSKImageCropperExample工程,并做交互操作即可.

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值