Plist文件

Plist文件_第1张图片

@property (nonatomic,strong)NSMutableArray *array;


[super viewDidLoad];

//初始化图片数组

self.array = [NSMutableArray array];

//请求数据

NSString *path = [[NSBundle mainBundle]pathForResource:@"0" ofType:@"plist"];

NSArray *arr = [NSArray arrayWithContentsOfFile:path];

for (NSDictionary *dic in arr) {

//初始化图片对象

MyImage *mi = [[MyImage alloc]init];

mi.url = dic[@"img"];

mi.width = dic[@"w"];

mi.height = dic[@"h"];

mi.price = dic[@"price"];

//加入数组

[self.array addObject:mi];

}

你可能感兴趣的:(Plist文件)