filesbox/app/filesbox_ios/FilesBox/Pods/PSImageEditors/README.md

86 lines
2.9 KiB
Markdown
Raw Normal View History

2023-09-20 08:37:14 +00:00
<p align="center" >
<img src="https://upload-images.jianshu.io/upload_images/4490624-904c1ed2a18ab850.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240" alt="PSImageEditors" title="PSImageEditors">
</p>
# PSImageEditors简而至美的一个图片编辑器
开源一个图片编辑组件,样式参照微信与钉钉的图片编辑效果,支持包括涂鸦,添加文字,添加马赛克,裁剪等功能,内部线上项目已使用此组件。
## 功能
##### 画笔
![1.jpg](https://upload-images.jianshu.io/upload_images/4490624-254d46f57a0d76e2.PNG?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
##### 文字(支持更换文字背景颜色)
![2.jpg](https://upload-images.jianshu.io/upload_images/4490624-8dff29894b7c64df.PNG?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
![3.jpg](https://upload-images.jianshu.io/upload_images/4490624-8ab1bcab20b55068.PNG?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
##### 马赛克(两种马赛克样式)
![4.jpg](https://upload-images.jianshu.io/upload_images/4490624-146ac352571cf626.PNG?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
##### 裁剪
![5.jpg](https://upload-images.jianshu.io/upload_images/4490624-c377e3568a7f7b0f.PNG?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
## Installation 安装
### 1手动安装
`下载Demo后,将子文件夹PSImageEditors拖入到项目中, 导入头文件PSImageEditors.h开始使用,注意: 项目中需要有Masonry.1.1.0!`
### 2CocoaPods安装
`pod 'PSImageEditors'`
如果发现pod search PSImageEditors 不是最新版本,可在终端执行 pod repo update 更新本地仓库,更新完成重新搜索即可。
### 3导入头文件 #import "PSImageEditors.h"
````
UIImage *image = [UIImage imageNamed:@"localImage_06@2x.jpg"];
PSImageEditor *imageEditor = [[PSImageEditor alloc] initWithImage:image delegate:self dataSource:self];
[self.navigationController pushViewController:imageEditor animated:YES];
````
### 4PSImageEditorDelegate
````
#pragma mark - PSImageEditorDelegate
- (void)imageEditor:(PSImageEditor *)editor didFinishEdittingWithImage:(UIImage *)image {
self.imageView.image = image;
[editor dismiss];
NSLog(@"%s",__func__);
}
- (void)imageEditorDidCancel {
NSLog(@"%s",__func__);
}
````
### 5参数设置
````
#pragma mark - PSImageEditorDelegate
- (UIColor *)imageEditorDefaultColor {
return [UIColor redColor];
}
- (PSImageEditorMode)imageEditorDefalutEditorMode {
return PSImageEditorModeDraw;
}
- (CGFloat)imageEditorDrawPathWidth {
return 5;
}
- (UIFont *)imageEditorTextFont {
return [UIFont boldSystemFontOfSize:24];
}
````
## Requirements 要求
* iOS 8+
* Xcode 8+
## 更新日志
```
- 2018.06.14 (tag:0.1.0)提交0.1.0版本
- 2020.07.16 (tag:0.2.0): 修复编辑图片模糊的问题UI更新
- 2020.07.23 (tag:0.2.1): 增加默认选中编辑选项功能
- 2020.08.19 (tag:0.2.2): 底部ToolBar修改文字组件优化体验
```