上篇博客说了利用MJExtension进行归档(http://blog.csdn.net/u010105969/article/details/79128051),本篇博客说说如何使用YYModel如何对自定义对象进行归档。
实际代码也很简单,只需在自定义类中重写方法:
(void)encodeWithCoder:(NSCoder*)aCoder {
[self yy_modelEncodeWithCoder:aCoder];
}
- (id)initWithCoder:(NSCoder*)aDecoder
{
self = [super init];
return [self yy_modelInitWithCoder:aDecoder];
}
demo地址:https://gitee.com/liangsenliangsen/LiYongYYModelGuiDang
本篇文章到这里就结束了,愿大家加班不多工资多,男同胞都有女朋友,女同胞都有男朋友。