objectiveC protocol issue Detail -> Master communi

2019-06-14 09:13发布

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条回答
成全新的幸福
2楼-- · 2019-06-14 09:16

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.

查看更多
登录 后发表回答