特点
- 使用观察者模式来实现跨层传递消息
- 一对多
一对多的实现机制

发送者发送通知到通知中心,有通知中心发送通知给所有的观察者
发送者:
[[NSNotificationCenter defaultCenter] postNotification:[NSNotification notificationWithName:UIKeyboardWillHideNotification object:nil]]
如何实现通知机制

发送者发送通知到通知中心,有通知中心发送通知给所有的观察者
发送者:
[[NSNotificationCenter defaultCenter] postNotification:[NSNotification notificationWithName:UIKeyboardWillHideNotification object:nil]]
本文标题:Objective-C:通知(NSNotification)
本文链接:https://www.haomeiwen.com/subject/iqbvvctx.html
网友评论