当我在 UITableView 中滚动时,rateView
is == nil 并且为每个单元格分配了内存。这是内存泄漏吗?或者当单元格滚动出屏幕并为下一个单元格的“rateView”分配新内存时,ARC是否会自动释放内存?
此代码位于layoutSubviews
我的自定义单元格中:
if (_rateView == nil) {
_rateView = [[DYRateView alloc] initWithFrame:CGRectMake(150, 7, 175, 50) fullStar:[UIImage imageNamed:@"StarFullLarge.png"] emptyStar:[UIImage imageNamed:@"StarEmptyLarge.png"]];
_rateView.padding = 8;
_rateView.alignment = RateViewAlignmentRight;
_rateView.editable = YES;
_rateView.delegate = self;
[_clearRateViewBg addSubview:_rateView];
}
_rateView.rate = _userRating.intValue;