?懶加載
// 懶加載
- (NSArray *)shops
{
if (_shops == nil) {
NSString *file = [[NSBundle mainBundle]pathForResource:@"shops" ofType:@"plist"];
_shops = [NSArray arrayWithContentsOfFile:file];
}
return _shops;
懶加載字典轉(zhuǎn)模型
// 懶加載字典轉(zhuǎn)模型
- (NSArray *)shops
{
if (_shops == nil) {
NSArray *dictArray= [NSArray arrayWithContentsOfFile:[[NSBundle mainBundle]pathForResource:@"shops" ofType:@"plist"]];
NSMutableArray *shopArray = [NSMutableArray array];
for (NSDictionary *dict in dictArray) {
HCShop *shop = [HCShop shopWithDict:dict];
[shopArray addObject:shop];
}
_shops = shopArray;
}
return _shops;
}