简体   繁体   English

将NSFetchedResultsController与UITableView中的特定部分相关联

[英]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.

相关问题 UITableView中带有NSFetchedResultsController的附加部分 - Additional section in UITableView with NSFetchedResultsController 具有NSFetchedResultsController的UITableView保留没有对象的节的标题 - UITableView with NSFetchedResultsController keep header for section without objects 从NSFetchedResultsController中删除部分时更新UITableView - update UITableView when section is removed from NSFetchedResultsController 如何将节与其UITableView中的headerLabel关联 - How to associate a section with its headerLabel in a UITableView 带有NSFetchedResultsController的UITableView:对每个部分彼此独立地排序 - UITableView with NSFetchedResultsController: Sort each section independently of each other iOS-将单元格添加到带有核心数据和NSFetchedResultsController的空UITableView部分 - iOS - Add a cell to empty UITableView Section w/ Core Data and NSFetchedResultsController 使用 NSFetchedResultsController 的 UITableView 部分中的意外标题视图 - Unexpected Header View in UITableView's section using NSFetchedResultsController 删除特定部分中的UITableView单元格 - Deleting a UITableView cell in a specific section 禁用特定UITableView部分的分隔符 - Disabling separator for a specific UITableView section UITableView的QuickDialog和NSFetchedResultsController - QuickDialog and NSFetchedResultsController for a UITableView
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM