[英]Associate NSFetchedResultsController with specific section in UITableView
I've got a UITableView that needs to display two sets of search results, with each set of search results being a different entity. 我有一个UITableView,它需要显示两组搜索结果,每组搜索结果是一个不同的实体。
Each entity needs to display its search results in a specific section. 每个实体都需要在特定部分显示其搜索结果。 I need to use an NSFetchResultsController so that if additional data becomes available the tableview automatically updates.
我需要使用NSFetchResultsController,以便在其他数据可用时,tableview自动更新。
My question is, how do I associate a specific NSFetchedResultsController with a specific section? 我的问题是,如何将特定的NSFetchedResultsController与特定的部分相关联? By this I mean I want all of the fetch results for entity 1 to be in section 0, while all of the search fetch results from entity 2 to be in section 1 of the tableview.
我的意思是,我希望实体1的所有获取结果都在第0部分中,而实体2的所有搜索获取结果都在tableview的第1部分中。
I've no problem having a tableview with a single section / single fetch controller, but is there anyway to have an NSFetchedResultsController be associated with a specific section of the table view? 我有一个带有单个部分/单个提取控制器的tableview没问题,但是总有一个NSFetchedResultsController与该表视图的特定部分相关联吗?
设置两个NSFetchedResultsController
,在节数委托方法中,指定2个节,对于节中行数的委托方法,查看节号并从适当的获取结果控制器中获取计数,然后在cellForRowAtIndexPath:
方法中,根据索引路径中的节号从相应的cellForRowAtIndexPath:
结果控制器获取数据。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.