为什么在dealloc方法中将scrollview的委托设置为零?

我发现,当我滑动一个tableview然后我按下了button,项目崩溃,消息是:消息发送到释放实例。 所以我加- (void)dealloc { [self.tableView setDelegate:nil]; } - (void)dealloc { [self.tableView setDelegate:nil]; }到我的项目和崩溃不会再发生。 但是我仍然不明白为什么如果我不添加上面提到的代码,项目会崩溃。 代表被释放,我仍然发送消息给它? 任何人都可以教我这个。 以下是scrollview中的代码做滚动方法。

 - (void)scrollViewDidScroll:(UIScrollView *)scrollView{ CGFloat y = scrollView.contentOffset.y; [self.navigationController.navigationBar lt_setBackgroundColor:GWPRGBColor(255, 255, 255, ((y-100)/100.0f))]; }