If the class is a custom class, after posting the notification, the selector corresponding to the observer is called twice.. Is there any better solution so that the selector is called only once?
+4
A:
If the selector is called twice, you've probably registered for it twice.
Argothian
2009-08-25 15:24:12
The problem is, There are two controls in the nib, which is customized to the same Class. and Since the observer is been registered in the awakeFromNib() of that Class, the selector is also called twice for a single postNotification. :(
lance
2009-08-26 13:48:06
+1
A:
If the observer class is registered for a notification by name, but not against a specific object, it will receive multiple messages, as it will be invoked every time the notification occurs, regardless of the originating object.
Likewise, if the observer is registered against a specific object, but not against a named notification, it will be messaged every time there is a notification concerning that object.
An alternative mechanism for being informed of changes in a distant state, is Key Value observing -http://developer.apple.com/documentation/Cocoa/Conceptual/KeyValueObserving/KeyValueObserving.html
cms
2009-08-25 19:32:48