核心数据无限深入研究

时间:2012-10-05 23:32:27

标签: core-data

我目前正在制作一个包含类别和子类别的表格列表,您可以使用向下钻取来浏览子类别,直到获得详细信息视图。

我从iphonesdkarticles.com获得了灵感。

本博客中关于无限钻取的解决方案是使用plist填充数组,使用单个UITableView进行深入分析。

我想使用NSFetchedResultsController而不是plist来使用核心数据。 我得到了第一个类别列表,但是当我点击其中一个类别时,我得到了一个空表。

我不知道在这种情况下使用NSFetchedResultsController是否是最合适的解决方案。当我使用didSelectRowatIndex时,也许我做错了什么:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

Categories *category = (Categories *)[fetchedResultsController objectAtIndexPath:indexPath];


MasterViewController *theViewController = [[MasterViewController alloc] initWithStyle:UITableViewStylePlain];
theViewController.CurrentLevel += 1;
theViewController.CurrentTitle = categories.name;

detailViewController.category = category;
[self.navigationController pushViewController:theViewController animated:YES];
}

1 个答案:

答案 0 :(得分:0)

要在Core Data中创建无限向下钻取,只需使实体成为自身的关系。

相关问题