Skip to content

Commit

Permalink
修复 KVO cntext 被移除的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
[email protected] committed Nov 23, 2017
1 parent 9ca514a commit 56f92b3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Classes/TableUtils/IMYAOPTableViewUtils.m
Original file line number Diff line number Diff line change
Expand Up @@ -118,17 +118,19 @@ - (void)bindingTableView:(UITableView *)tableView aopClass:(Class)aopClass
for (id observance in observanceArray) {
NSString *keyPath = [observance valueForKeyPath:@"_property._keyPath"];
id observer = [observance valueForKey:@"_observer"];
id context = nil;
if (observer && keyPath) {
NSKeyValueObservingOptions options = 0;
@try {
context = [observance valueForKey:@"_context"];
options = [[observance valueForKey:@"_options"] unsignedIntegerValue];
} @catch (NSException *exception) {
IMYLog(@"%@", exception.debugDescription);
}
if (options == 0) {
options = (NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew);
}
[tableView addObserver:observer forKeyPath:keyPath options:options context:nil];
[tableView addObserver:observer forKeyPath:keyPath options:options context:(void *)context];
}
}
}
Expand Down

0 comments on commit 56f92b3

Please sign in to comment.