I have a tab bar controller and inside it two controllers: a mapview controller and a tableview + NSFetcheddata controller. Both display info about a specific day from core data and have a button to display a day selector modally.
I have achieved having my controllers dataset changing when their modal view controller disappears through delegation but I would like the two controllers to update their data and not only the one who displayed the modal controller.
I thought about creating a protocol in both controllers and setting each other as its delegate but I would like to know if I’m doing right here.
Cheers,
Thierry
There are tons of different ways to do this. One way is to use NSNotificationCenter. Define your own custom notification name:
Subscribe to this notification in both of your controllers:
And implement
dataUpdated:to update your data:In the controller causing the change, post the notification: