1.添加一个观察者
method接收一个Ref*指针,为发送者
- NotificationCenter::getInstance()->addObserver(this,callfuncO_selector(ClassName::method),"message",nullptr);
2.广播消息
发送一个消息,发送者为类本身
- NotificationCenter::getInstance()->postNotification("message",this);
1.添加一个观察者
method接收一个Ref*指针,为发送者
- NotificationCenter::getInstance()->addObserver(this,callfuncO_selector(ClassName::method),"message",nullptr);
2.广播消息
发送一个消息,发送者为类本身
- NotificationCenter::getInstance()->postNotification("message",this);