@property (nonatomic, strong) id observer;
- (void) viewDidLoad {
self.observer = [[NSNotificationCenter defaultCenter] addObserverForName:UIApplicationDidEnterBackgroundNotification
object:nil
queue:[NSOperationQueue mainQueue]
usingBlock:^(NSNotification *note) {
NSLog("hello");
}];
}
- (void)dealloc {
[[NSNotificationCenter defaultCenter] removeObserver:observer];
observer = nil;
NSLog(@"__dealloc__");
}
上一篇
UIProgressView设置圆角
2018-03-02
下一篇
KVC机制如何通过key找到value
2018-01-07