NSNotification 常用的几个方法,代码如下:

// 发送通知
[[NSNotificationCenter defaultCenter] postNotificationName:@"broadcastName" object:nil]; // 接收通知
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(doSomething:) name:@"broadcastName" object:nil]; // 移除通知
[[NSNotificationCenter defaultCenter] removeObserver:self name:@"broadcastName" object:nil];
05-27 09:31