【发布时间】:2026-02-12 02:45:01
【问题描述】:
我有一个属性“term”,它是我的核心数据“Event”中的一个 NSString。 加载表格视图时,我希望将“名称”的所有值加载到数组中。
我使用了代码
- (void)configureCell:(UITableViewCell *)cell atIndexPath:(NSIndexPath *)indexPath {
Event *event = nil;
event = [fetchedResultsController objectAtIndexPath:indexPath];
if(searching){
cell.textLabel.text = [copyListOfItems objectAtIndex:indexPath.row];
}else{
if(event.term){
[listOfItems addObject:event.term];
}
cell.textLabel.text = event.term;
cell.detailTextLabel.text = event.definition;
}
}
问题是所有术语都没有加载到 NSMutableArray listOfItems 中。它在表格单元格滚动到底部时加载。
如何将核心数据中“term”的所有内容加载到数组listOfItems中。
任何帮助将不胜感激。
【问题讨论】:
标签: iphone objective-c cocoa-touch xcode core-data