测试已测试 | ✓ |
Lang语言 | Obj-CObjective C |
许可证 | MIT |
发布最后发布 | 2014年12月 |
由Illya Busigin维护。
由Illya Busigin编写
UIBezierPathSerialization
在 JSON 和 UIBezierPath 对象之间进行编码和解码,遵循 Foundation 的 NSJSONSerialization
类的 API 约定。输出的 JSON 实现了 Path to JSON 建议的子集,允许将 SVG 路径序列化为标准化的 JSON 对象。
要安装 UIBezierPathSerialization
,只需将类文件拖放到您的项目中。或者,如果您使用的是 CocoaPods,只需在您的 Podfile
中指定 pod 'UIBezierPathSerialization'
即可。
#import "UIBezierPathSerialization.h"
UIBezierPath *bezierPath = [UIBezierPath bezierPathWithRect:CGRectMake(0, 0, 100, 100)];
NSError *error = nil;
NSData *data = [UIBezierPathSerialization dataWithBezierPath:bezierPath options:0 error:&error];
#import "UIBezierPathSerialization.h"
NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"simple_path" ofType:@"json"];
NSData *data = [NSData dataWithContentsOfFile:path];
NSError *error = nil;
UIBezierPath *bezierPath = [UIBezierPathSerialization bezierPathWithData:data options:0 error:&error];
本组件不提供支持。如果您想提出一个功能或发现一个错误,请通过 GitHub 问题跟踪器 提交功能请求。
欢迎提交修复错误和功能的 pull request!
UIBezierPathSerialization 在 MIT 许可下提供。更多信息请查看 LICENSE 文件。