#import "ViewController.h"
#import "QZApp.h"
@interface ViewController()
//创建一个plist文件数据的容器
@property(nonatomic,strong)NSArray *appList;
@end
@implementation ViewController
//这是懒加载的形式
-(NSArray *)appList
{
if(_appList ==nil){
NSArray *dictArray = [NSArray arrayWithContentsOfFile:[[Nsbundle mainBundle] pathForResource:@"app.plist" ofType:nil]];
//字典转模型
NSMutableArray *arrayM = [NSMutableArray array];
for(NSDictionary *dict in dictArray){
CZApp *app = [CZApp appWithDict:dict];
[arrayM addObject:app];
}
_appList = arrayM
}
return _appList;
}
oc的字典转模型
最新推荐文章于 2020-11-16 21:16:11 发布