ResultsController to another ResultsController

女生的网名这么多〃 提交于 2019-12-11 02:15:23

问题


CoreData and ResultsController make the job really easy. But...

Here is the situation:

I have a functional resultsController in one tableView. When selecting a row, I go to another tableView that will show the child entity. With coreData, the child entity is ready to use. But how do I start another resultsController with this child entity? Do I need to fetchRequest again for this new resultsController using predicate to filter?

Parent TablewView: Select row on resultsController -> Child TableView: init from entity received and init another resultsController -> Desc of Child TableView: show detail from the row selected on the second RC.

Is there a better way?


回答1:


If your second UITableView is just presenting the detail of 1 NSManagedObject, why create a resultsController. Pass a pointer to the NSManagedObject to the new TableView and handle it's displaying in the UITableViewDataSource protocol method.
You may want to order the element you want for each row in a NSArray, for shorter - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath implementation.
The NSArray must be done before the TableView first try to display itself.



来源:https://stackoverflow.com/questions/8736692/resultscontroller-to-another-resultscontroller

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!