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];
   }

 

posted on 2019-01-30 10:05  代码少年_夕阳  阅读(333)  评论(0编辑  收藏  举报