這開始發生在藍色之外。任何想法:代碼:表格單元沒有被重用的索引路徑
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