-(NSArray )getAndParseWithPlistFile:(NSString )fileName withClass:(Class)modelClass {
//从bundle中获取文件
NSString *filePath = [[NSBundle mainBundle] pathForResource:fileName ofType:nil];
NSArray *dataArray = [NSArray arrayWithContentOfFile:filePath];
;
// 解析
//创建一个临时可变数组
NSMutableArray *mutableArray = [NSMutableArray array];
for (NSDictionary *dataDic in dataArray) {
//一个一个解析:kvc
id newInstance = [modelClass alloc]init];
[newInstance setValuesForKeysWithDictionary:dataDic];
//将解析玩的分类模型添加到可变数组
[mutableArray addobject:newInstance];
}
return [mutableArray copy];
}
//仅作为课堂笔记