Commit bbe45f51 authored by 汪洋's avatar 汪洋

Merge branch 'jinzhu/master' into 'master'

修改removeKVO



See merge request !9
parents 709c8acf f98eb318
...@@ -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