Reputation: 1
I want to make up a tableview that has 2 sections with a fetchedResultsController.
I have a data model like this :
A Company Entity has to many relationship with Employees entity, has to one relationship with employer entity.
I was trying to use a fetchedResultsController that , and fill the cells in tableView's first section with employees, in tableView's second section with a employer.
But failed to make up cells.
What I want is make up cells with fetchedResultsController : fill the employers in section 1, fill the employ in section 2.
Is it possible with fetchedResultsController?
If is it possible, how to make a keyPath for divide sections?
Or am I have to use fetchRequest, fetchRequest ?
Upvotes: 0
Views: 73
Reputation: 8563
The indexPath that is returned from a fetchedResultsController is really useful for interoperability with a tableView or collectionView. But it does not have to be a one-to-one relationship. You can have a setup where one section points to one fetchedResultsController and another section points to a different one. The key in doing this setup is to make sure to not confuse the fetchedResultsController indexPath with your tableView's indexPath. Generally I find having a separate object to manage converting the indexPath is the easiest way to keep it straight.
Upvotes: 1