Ios 将数据加载到UITableView中

Ios 将数据加载到UITableView中,ios,objective-c,uitableview,Ios,Objective C,Uitableview,我现在正在将常规数据加载到我的表视图中,正如您在我的单元格中看到的那样,StopAndCheckQuestions是从核心数据生成的类 如何加载数据 - (void)viewDidLoad { [super viewDidLoad]; CoreDataHelper * helper = [CoreDataHelper getCDHelper]; FirstQuestions =[helper fetchEntitiesForClass:[StopAndCheckQuest

我现在正在将常规数据加载到我的
表视图中,正如您在我的
单元格中看到的那样,StopAndCheckQuestions是从核心数据生成的类

如何加载数据

- (void)viewDidLoad
{
    [super viewDidLoad];
    CoreDataHelper * helper = [CoreDataHelper getCDHelper];
    FirstQuestions =[helper fetchEntitiesForClass:[StopAndCheckQuestions class] withPredicate:nil];
}



   static NSString *CellIdentifier = @"FirstQuestionCell";
    QuestionCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell ==nil) {
        cell = [[QuestionCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
    }
    StopAndCheckQuestions *questions = [FirstQuestions objectAtIndex:indexPath.row];
    cell.lblQuestion.text = questions.question;
    return cell;
没什么特别的。 但是现在我想加载依赖于
外键的数据,这意味着我想要
外键(
titleId)为1的所有数据

有人能帮我提供一个样品或其他东西吗


谢谢你的帮助和快速回答

为此,您可以使用NSPredicate

NSPredicate *pred = [NSPredicate predicateWithFormat:@"KEY ==%i ", 1];
    NSArray *res = [FirstQuestions filteredArrayUsingPredicate:pred];

您的意思是,在不更新NSFetchResultController的情况下,您可以提供coreData模型的快照吗?希望检查我是否理解您的结构(最好是树/图模式或表模式中的相关实体),谢谢您的回答,但我的核心数据中没有作为外键的属性,是否需要添加此属性,没有别的办法吗?你的意思是你在StopAndCheckQuestions中没有标题ID?是的,这就是我的意思,我只是在CoreDatay中有与StopAndCheckTitle的关系。你没有在你的StopAndCheckQuestions中添加这个吗?只需将其添加到您的表中。这是这个问题最简单的解决方案不,我没有在StopAndCheckQuestions中添加titleId,但是不可能访问关系吗?