Open wyhazq opened 8 years ago
+ (id) modelWithJSON:(id) json {
id objs = nil;
if ([json isKindOfClass:[NSArray class]]) {
objs = [NSArray yy_modelArrayWithClass:[self class] json:json];
} else if([json isKindOfClass:[NSDictionary class]]) {
objs = [self yy_modelWithJSON:json];
} else if([json isKindOfClass:[NSString class]]) {
objs = [self yy_modelWithJSON:json];
} else if([json isKindOfClass:[NSData class]]) {
objs = [self yy_modelWithJSON:json];
}
return objs;
}
如果不影响效率,在NSObject (YYModel)增加这样一个方法可好?