比方说,我有一类这种发帖称快速触发:寿命NSNotification对象的
[[NSNotificationCenter defaultCenter] postNotificationName:kGotData object:nil userInfo:someDictionaryObject];
而且从另一个类的观察员:
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(gotData:) name:kGotData object:nil];
-(void)gotData:(NSNotification *)notification
{
NSDictionary *myUserInfo = notification.userInfo;
// more code to process userInfo, etc.
}
如果gotData需要更长的时间来处理myUserInfo比它确实接收来自通知中心的呼叫吗?
如果我有两个观察者,那么可以比另一个更快处理? – user523234
@ user523234然后就好像发布通知的对象依次被调用一样。所以这将是'postNotificationName:'调用返回之前两个处理位的总时间。 – Tommy