NSNotificationCenter
2016-03-17 本文已影响117人
小黄人写代码
id observer = [[NSNotificationCenter defaultCenter] addObserverForName:@"XXX" object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification * _Nonnull note) {
NSLog(@"doing...");
}];
// 销毁方法如下:
[[NSNotificationCenter defaultCenter] removeObserver:observer];