1.背景
为了监听tableview的移动
[_tableView addObserver:self forKeyPath:@"contentOffset" options:NSKeyValueObservingOptionNew context:nil];
2.问题
奔溃报错Attempting to load the view of a view controller while it is deallocating is not allowed and may result in undefined behavior
3.解决
- (void)dealloc
{
[_tableView removeObserver:self forKeyPath:@"contentOffset" context:nil];
}