美文网首页
NSNotificationCenter

NSNotificationCenter

作者: 小黄人写代码 | 来源:发表于2016-03-17 23:27 被阅读117次
id observer = [[NSNotificationCenter defaultCenter] addObserverForName:@"XXX" object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification * _Nonnull note) {
  NSLog(@"doing...");
}];
    
// 销毁方法如下:
[[NSNotificationCenter defaultCenter] removeObserver:observer];

相关文章

网友评论

      本文标题:NSNotificationCenter

      本文链接:https://www.haomeiwen.com/subject/zqbclttx.html