0

ここにあるように、通常のデータ読み込みを実行してtableviewいますcellForRowAtIndexPath。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) が 1foreign keyであるすべてのデータが必要であることを意味します。foreign key(

誰かが私を助けて、おそらくサンプルか何かを提供してくれませんか

助けてくれてありがとう!

4

1 に答える 1

0

この目的のためにNSPredicateを使用できます

NSPredicate *pred = [NSPredicate predicateWithFormat:@"KEY ==%i ", 1];
    NSArray *res = [FirstQuestions filteredArrayUsingPredicate:pred];
于 2013-10-30T09:45:20.170 に答える