CJMImageCategory
与 UIImage 相关的接口扩展,包括图片缩放、染色、纯色图片共享等。
示例
要运行示例项目,请克隆仓库,然后首先从 Example 目录中运行 pod install
。
- UIImage (CJMImageResize) 图片缩放
UIImage *image = [UIImage imageNamed:@"image.png"];
UIImage *resizeImage = [image cjmi_resizeImageWithScale:0.5];
- UIImage (CJMImageTintColor) 图片染色
// 将图片进行染色
UIImage *tintImage = [image cjmi_tintImageWithColor:[UIColor redColor]];
// 生成一张纯色的图片
UIImage *tintColorImage = [UIImage cjmi_tintImageWithColor:[UIColor redColor] size:CGSizeMake(10, 10)
scale:1];
- UIImage (CJMImageShareTintImage) 共享纯色的图片,如果使用这种纯色的图片比较多,可以使用这种共享的方式。
// 分享一张图片,如果不存在该颜色值的图片,则新建一张。
UIImage *shareImage = [UIImage cjmi_shareImageWithColor:[UIColor redColor]];
版本
- 0.1.0 版本新增图片缩放、图片染色、共享图片等接口。
要求
安装
CJMImageCategory 通过 CocoaPods 提供使用。要安装它,只需将以下行添加到您的 Podfile 中
pod 'CJMImageCategory'
作者
chenjm, [email protected]
许可证
CJMImageCategory遵循MIT许可证。有关更多信息,请参阅LICENSE文件。