Reputation: 1906
I'm having a model that holds a bunch of items and sends an update notification when an item was modified. In this case there are two view controllers listening for this modification notification in order to update their state/(table-)views.
The problem is, that if one controller modifies an item it also receives the update notification and reloads it's content. But I don't want the controller who made the changes to be updated instantly, because it would interrupt the changes animation that the controller performs (because it knows what has changed).
Is there a good solution to only receive updates that weren't made by a specific controller? Or am I on the wrong path altogether?
Thanks!
Upvotes: 2
Views: 123
Reputation: 289
You could try 2 different approaches:
First one is to use the "object" or " user info" information that you can add to a NSNotification object, send the view controller pointer and react on the notifications only when the object or user info is different than the object reacting to the notification.
The second approach is that you could remove your view controller from the NSNotificationCenter before performing the change, and adding it again afterwards.
Upvotes: 2