-
(void)setShop
_shop = shop; 重写set方法是 成员变量 一定要重新 赋值
}
- (instancetype)init
{
if (self = [super init]) {
}
return self;
}
- (void)layoutSubviews
{
[super layoutSubviews];
}
/**
- 懒加载
*/
-
(NSArray *)shops
{
if (_shops == nil) {NSString *path = [[NSBundle mainBundle] pathForResource:@"shops.plist" ofType:nil]; NSArray *dictArr = [NSArray arrayWithContentsOfFile:path]; NSMutableArray *shopArr = [NSMutableArray array]; for (NSDictionary *dict in dictArr) { JSShopModel *shop = [JSShopModel shopWithDict:dict]; [shopArr addObject:shop]; } _shops = shopArr;
}
return _shops;
}
网友评论