我需要创建两个类,两者都应该能够通过NSNotificationCenter方法发送和接收事件.两者都应该有sendEvent和receiveEvent方法:
@implementation Class A
-(void)sendEvent
{
addObserver:--- name:---- object:---
}
-(void)ReceiveEvent
{
postNotificationName: --- object:---
}
@end
Run Code Online (Sandbox Code Playgroud)
与另一个类相同,ClassB也应该能够发送和接收事件.怎么做到呢?