NinePatchKit
NinePatch 图像解析和渲染框架,适用于 iOS 和 macOS
多语言翻译
主要特性
- 解析 png 的二进制数据以获取其块数据
- 根据 npTc 块切片图像,然后以规则绘制它们
- NinePatchImageView 拥有类似于 UITableViewCell 的 contentView,您可以在其中放置任何 UI 对象
- 支持水平翻转和垂直翻转
- 支持多平台
- 支持自动布局
需求
- iOS 9.0+
- macOS 10.11+
效果
安装
CocoaPods
推荐使用 CocoaPods 进行安装。在你的 Podfile
文件中添加以下内容
pod 'NinePatchKit'
手动安装
将 NinePatchUtils 目录复制到您的项目中
入门指南
#import <NinePatchKit/NinePatchKit.h>
...
NSString * path = [[NSBundle mainBundle] pathForResource:@"YourNinePatchImageName" ofType:@"png"];
NinePatchImageView * imageView = [[NinePatchImageView alloc] init];
imageView.showImage = [NinePatchUtils imageWithContentsOfFile:path];
授权
NinePatchKit
遵循 MIT 协议。