Commit f98eb318 authored by 乔金柱's avatar 乔金柱

修改removeKVO

parent 709c8acf
...@@ -162,7 +162,10 @@ ...@@ -162,7 +162,10 @@
} }
- (void)removeKVO{ - (void)removeKVO{
// 因为fetchDataSuccess是在viewDidLoad中监听的,所以需要一个判断
if ([self isViewLoaded]) {
[self.viewModel removeObserver:self forKeyPath:@"fetchDataSuccess"];
}
} }
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context{ - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context{
...@@ -191,10 +194,7 @@ ...@@ -191,10 +194,7 @@
- (void)dealloc{ - (void)dealloc{
[self removeKVO]; [self removeKVO];
// 因为fetchDataSuccess是在viewDidLoad中监听的,所以需要一个判断
if ([self isViewLoaded]) {
[self.viewModel removeObserver:self forKeyPath:@"fetchDataSuccess"];
}
} }
- (void)showEmptyView:(GMEmptyViewType)type { - (void)showEmptyView:(GMEmptyViewType)type {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment