コンテンツを追加するために、別のビューコントローラーを使用してテーブルビューのカスタムセルを作成しました。しかし、不思議なことにコンテンツの表示が遅い。ほとんどの場合、中心線のみが表示され (何も表示されない場合もあります)、セルで遊んでしばらくすると、残りのコンテンツ (合計 3 行) が最終的に表示されます。
しばらくして、
すべてがそこにあります。
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
eatEventTableViewCell *cell = (eatEventTableViewCell*)[tableView dequeueReusableCellWithIdentifier:@"expenseCell"];
if (cell == nil) {
cell = [[eatEventTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"expenseCell"];
}
[self configureCell:cell atIndexPath:indexPath];
return cell;
}
- (void)configureCell:(eatEventTableViewCell *)cell atIndexPath:(NSIndexPath *)indexPath
{
NSManagedObject *object = [self.fetchedResultsController objectAtIndexPath:indexPath];
cell.nameField.text = [[object valueForKey:@"descText"] description];
cell.tagsField.text = [[object valueForKey:@"type"] description];
cell.creationDateLabel.text = [eatAddViewController dateFormat:[[object valueForKey:@"timeStamp"] description] :TRUE];
if([eatExpenseType getSelectionValue :cell.tagsField.text :m_setting])
{
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
}
else
{
cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton;
}
}