【iOS】NSNotification 常用方法

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];

 

posted @ 2015-11-21 21:44  WriteOnRead  阅读(176)  评论(0编辑  收藏  举报