简体   繁体   中英

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.

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.

My question is, how do I associate a specific NSFetchedResultsController with a specific section? 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.

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?

设置两个NSFetchedResultsController ,在节数委托方法中,指定2个节,对于节中行数的委托方法,查看节号并从适当的获取结果控制器中获取计数,然后在cellForRowAtIndexPath:方法中,根据索引路径中的节号从相应的cellForRowAtIndexPath:结果控制器获取数据。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM