2010-05-06 8 views
1

내 배열의 개별 요소에 액세스하려고합니다. 이것은 내가 액세스하려고 시도하는 배열 내용의 예입니다.객관적인 c의 배열에서 요소에 액세스

<City: 0x4b77fd0> (entity: Spot; id: 0x4b7e580 <x-coredata://D902D50B-C945-42E2-8F71-EDB62222C0A7/Spot/p5> ; data: { 
    CityToProvince = 0x4b7dbd0 <x-coredata://D902D50B-C945-42E2-8F71-EDB62222C0A7/County/p15>; 
    Description = "Friend"; 
    Email = "[email protected]"; 
    Age = 21; 
    Name = "Adam"; 
    Phone = "+44175240"; 
}), 

이름, 전화 등이 ...

어떻게 내가이 일에 대해 갈 것이라고하는 액세스하기 위해 노력하고 요소는?

UPDATE



:
OK, 지금 핵심 데이터를 찾고 이해, 어떻게 내 테이블보기에 표시되는 개체를 제거하는 방법에 대한 갈 것이라고?

(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 

    NSManagedObject *object = (NSManagedObject *)[entityArray objectAtIndex:indexPath.row]; 

    NSString *CellIdentifier = @"Cell"; 

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; 
    if (cell == nil) { 
     cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease]; 
    } 



    // Configure the cell... 

    return cell; 
} 

답변

3

이는 배열처럼 보이지 않습니다. 코어 데이터 엔티티처럼 보입니다. 배열이 일 수 있지만 엔티티 자체의 멤버에 액세스하려는 것처럼 보입니다. 이렇게하려면 NSManagedObject 메서드 을 사용할 수 있습니다.

NSManagedObject *entity = /* ... retrieve entity from Core Data ... */; 
NSString *name = [entity valueForKey:@"Name"]; 
관련 문제