博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
[翻译] RSKImageCropper
阅读量:7067 次
发布时间:2019-06-28

本文共 1907 字,大约阅读时间需要 6 分钟。

RSKImageCropper

https://github.com/ruslanskorb/RSKImageCropper

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

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

Installation - 安装

 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 () 

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工程,并做交互操作即可.

 

转载地址:http://ertll.baihongyu.com/

你可能感兴趣的文章
snmp安装
查看>>
elasticsearch常用操作命令
查看>>
设置sqlplus提示符
查看>>
存储类说明符
查看>>
MySQL 简易序列
查看>>
nginx keepalive
查看>>
Markdown 语法说明
查看>>
CentOS 7.0安装配置LAMP服务器(Apache+PHP+MariaDB)
查看>>
Django 跨表查询--神奇的双下划线和点
查看>>
h3cte D图 搭建
查看>>
Linux 文件基本属性
查看>>
【转】js获取当前指定的前几天的日期(如当前时间的前七天的日期)
查看>>
javascript中对象字面量的理解
查看>>
centos 普通用户获得sudo超级权限
查看>>
Web内容管理系统 Magnolia
查看>>
tmux命令使用总结
查看>>
百度--买帽子
查看>>
SDWebImage的使用
查看>>
PC端和移动端测试区别
查看>>
TCP/IP中的四元组、五元组、七元组
查看>>