そのため、Core Data で mogenerator を使用しています。最初にテーブルビューをロードしたときに、resultsController は有効な属性を持つ適切なオブジェクトを返します。しかし、テーブルをスクロールすると、リロードされたすべてのセルに、resultsController から返された null 属性を持つオブジェクトが取り込まれます。キャッシングの問題ですか?
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
// Configure the cell...
Log *log = [self.resultsController objectAtIndexPath:indexPath];
cell.textLabel.text = [NSString stringWithFormat:@"%@", log.text];
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
return cell;
}