【发布时间】:2015-06-14 00:58:15
【问题描述】:
所以我在 CoreData 中有两个实体(A 和 B)。 A 有很多 B,B 只能属于一个 A。我设法在 tableview 上显示 A,当我点击一个单元格时,它应该与另一个显示 Bs 列表的 tableview 控制器相连接。我正在使用 NSFetchedResultsController 来监控我的表格视图。在我的 didSelectRowAtIndexPath 方法中,我有:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
self.tappedIndex = indexPath;
NSLog(@"Index tapped is %@",self.tappedIndex);
NSLog(@"%@",[self.fetchedManagedResultsController objectAtIndexPath:self.tappedIndex] );
}
NSLog 的输出是:
<B: 0x1700b1a00> (entity: B; id: 0xd000000000500000 <x-coredata://5A01CF10-0E90-496F-9B84-FAF68346D6DC/Customer/p20> ; data: {
items = "<relationship fault: 0x174221ee0 'items'>";
name = "Connie Brittani ";
phone = 8034233759;
})
我的问题是如何将项目传递给第二个表格视图。任何帮助表示赞赏!
【问题讨论】:
标签: uitableview core-data nsfetchedresultscontroller nsmanagedobject