- (instancetype)initWithDict:(NSDictionary *)dict{
if (self = [super init]) {
// 一般方法如下,如果模型中有大量数据,一项一项写工作量很大
//self.name= dict[@"name"];
//self.icon= dict[@"icon"];
[self setValuesForKeysWithDictionary:dict];
}
return self;
}
+ (instancetype)userModelWithDict:(NSDictionary *)dict{
return [[self alloc] initWithDict:dict];
}
网友评论