コード全体は次のとおりです。
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"DetailCell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue2
reuseIdentifier:CellIdentifier];
NSUInteger sectionIndex = [indexPath section];
NSUInteger rowIndex = [indexPath row];
NSDictionary *section = [self.sections objectAtIndex:sectionIndex];
NSArray *rows = [section objectForKey:@"rows"];
NSDictionary *row = [rows objectAtIndex:rowIndex];
cell.textLabel.text = [row objectForKey:@"label"];
cell.detailTextLabel.text = [[self.myManagedObject valueForKey:[row objectForKey:@"key"]] description];
return cell;
}
私の質問は次のとおりです。
cell.textLabel.text = [row objectForKey:@"label"];
cell.detailTextLabel.text = [[self.myManagedObject valueForKey:[row objectForKey:@"key"]] description]; //This is NSDate
- このコードでは、objectForKey と valueForKey という 2 つの異なる形式を使用しているのはなぜですか?
- objectForKey で self.myManagedObject を呼び出す必要がないのはなぜですか?
- 説明の目的は何ですか?