这开始发生在蓝色之外。任何想法:代码:表格单元没有被重用的索引路径
CUSTOMCLASSNAME(我已经更换了实际的类名称,因为它包含了客户端的名称。)
正开始我的tableView:
[self.tableView registerClass:[CUSTOMCLASSNAME class] forCellReuseIdentifier:[self reuseIdentifier]];
在单元格为行:
嗨,标题正在控制台中打印。这是我的cellForRow:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
AVTCheckListTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:[self reuseIdentifier] forIndexPath:indexPath];
[self configureCell:cell atIndexPath:indexPath];
return cell;
}
- (void)configureCell:(AVTCheckListTableViewCell *)cell atIndexPath:(NSIndexPath *)indexPath {
ChecklistGroup *group = [self.checklistFetchedResultsController.fetchedObjects objectAtIndex:indexPath.section];
ChecklistItem *item = [self getChecklistItemForIndexPath:indexPath];
[cell setSelectionStyle:UITableViewCellSelectionStyleNone];
[[cell cellTextView] setAttributedText:[[item checked] boolValue] ? [[NSAttributedString alloc] initWithString:[item name] attributes:@{ NSStrikethroughStyleAttributeName : @(NSUnderlineStyleSingle) } ] : [[NSAttributedString alloc] initWithString:[item name]]];
[[cell cellTextView] setUserInteractionEnabled:[[group isUserDefined] boolValue]];
[[cell cellTextView] setTag:indexPath.row];
[[cell cellTextView] setDelegate:self];
[[cell tickImage] setHidden:![[item checked] boolValue]];
}
//Method that returns re-use:
- (NSString *) reuseIdentifier {
return @"CheckListTableView";
}
什么开始发生了蓝色的 – rdelmar
喜误差标题被重复使用的表格单元格没有索引路径。 表格视图在滚动时会出现不稳定的行为。直到所有的单元格被加载,但由于它们没有被重用,这是一个问题。 – CW0007007
根本不清楚你遇到了什么问题。请在您的帖子中添加更多信息来解释您的问题。如果你的应用程序抛出一个异常,也包括这一点。 – Aaron