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?

Answers


After you set up the two NSFetchedResultsControllers, in the number of sections delegate method, specify 2 sections, for the delegate method for number of rows in a section, look at the section number and get the count from the appropriate fetched results controller, and in the cellForRowAtIndexPath: method, get the data from the appropriate fetched results controller based on the section number in the index path.


Need Your Help

Having trouble with releases in core graphics

iphone objective-c ios core-graphics drawrect

I've just started with releasing in core graphics, so I might need a little help.

How to upload files on server folder using jsp

java image jsp servlets upload

I am trying to upload some images on folder which locates on my server using servlet/jsp.