1
我正试图添加一个简单的UIActivityIndicatorView到多个表格单元格。活动指示器是每个单元的相同对象。但是,由于某些原因,它仅显示在表格的最后一个单元格中。在所有tableview单元格中的活动指示器,只显示在最后一个
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease];
}
cell.accessoryView = _activityView;
cell.textLabel.text = [_tableItems objectAtIndex:indexPath.row];
cell.textLabel.textColor = DARK_GRAY;
cell.detailTextLabel.text = [_tableSubtitles objectAtIndex:indexPath.row];
cell.detailTextLabel.textColor = DARK_GRAY;
return cell;
}
在我看来,这个码应该有每个单元对象抓住一个指向同一个活动视图,因此每个小区的附属视图应该显示相同活动的指标。但是,除了tableView上的最后一个单元格外,其他任何单元格的附件视图都不会显示任何结果,它会按预期方式显示活动指示符。感谢有关发生这种情况的任何提示。