さまざまな関係からのさまざまな宛先エンティティをすべて表示する必要があるテーブルビューがあります。簡単にするために、1 つの関係を見てみましょう。エンティティ Operation から Goal への関係です。 Relationshipname: goal (逆: operationisation)
セルを埋める方法が気になる
これは私が持っているものです:
- (void)viewWillAppear:(BOOL)animated{
goals = [[NSArray alloc] init];
goals = [[self.operation valueForKeyPath:@"goal.goalNaam"] allObjects] ;
}
と
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue2 reuseIdentifier:CellIdentifier];
}
if(indexPath.section == 2){
Goal *goal = (Goal*)[goals objectAtIndex:indexPath.row];
cell.textLabel.text = goal.goalNaam;
}
// Configure the cell...
return cell;
}
私はこれがそれを行う方法だと思っています。シミュレータはジャムしますが、エラーは発生しません..