Khi nào chính xác layoutSubviews
được gọi trên tùy chỉnh UITableViewCell
trong phương thức UITableViewCells
cellForRowAtIndexPath
? Dưới đây, tôi cần layoutSubviews
để được gọi SAU KHI tôi đặt thuộc tính FiltersTableViewCellItem
. Tôi có thiết lập chính xác không? Tôi muốn có thể sử dụng layoutSubviews
vì tôi nghe nói nó tốt hơn cho hiệu suất.Khi chính xác LayoutSubviews có được gọi cho UITableViewCell tùy chỉnh không?
- (UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *cellIdentifier = @"FiltersTableViewCell";
FiltersTableViewCell *filtersTableViewCell = [[self dequeueReusableCellWithIdentifier:cellIdentifier] retain];
FiltersTableViewCellItem *filtersTableViewCellItem = [[self.filtersTableViewCellItems objectAtIndex:[indexPath row]] retain];
if (!filtersTableViewCell)
{
filtersTableViewCell = [[FiltersTableViewCell alloc] initWithFiltersTableViewCellItem:filtersTableViewCellItem];
filtersTableViewCell.delegate = self;
}
else
{
filtersTableViewCell.filtersTableViewCellItem = filtersTableViewCellItem;
}
return [filtersTableViewCell autorelease];
}
@Danny Lin ARC không liên quan gì đến cải thiện hiệu suất. Trong thực tế nó có nhiều tác dụng tương tự như autorelease. –