objectiveC protocol issue Detail -> Master communication [closed]

我的梦境 提交于 2019-12-08 13:41:45

问题


I am using a UISplitViewController to manage the Master and Detail view. Everything is working fine going from master to detail. I can select an item from the list and through the delegate it updates the detail view.

I want to be able to delete an item using a button on the detail view. This is very simple to do on the detail view. However, I cannot seem to figure out how to change the master view to reflect the fact that an item has been deleted.

Here is my example: SampleCode


回答1:


Make the master a delegate of the detail view. That is: when you fire up the detail from the master, tell the detail who the master is, preferably by using a delegate construction.That way the detail can inform the master when any changes should occur.

Or you can also put the data in CoreData, and have the master notified automatically when a changes occurs in the CoreData tables. Check NSManagedObjectContextObjectsDidChangeNotification for more info.



来源:https://stackoverflow.com/questions/10463394/objectivec-protocol-issue-detail-master-communication

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