2011年4月15日 星期五

NSNotificationCenter

- (void)addObserver:(id)observer selector:(SEL)aSelector :(NSString *)aName object:(id)anObject;
register to receive notification
parameter:
1. observer: the object to receive notification

2. aName: name of notification, if it is nil, we receive all notifications sent out by anObject

3. anObject: specify object we want to observe. If it is nil, we receive all notification with aName

we can register many objects to receive same notification.


- (void)postNotificationName:(NSString *)aName object:(id)anObject;
send notfication
parameter:
anObject: sender




沒有留言:

張貼留言