I found when I slide a tableview then I pressed back button, the project crashed and the message is :message sent to deallocated instance. So I add
- (void)dealloc {
[self.tableView setDelegate:nil];
}
to my project and the crash doesn't happen again.
But I still can't understand why the project will crash if I didn't add the code mentioned above. The delegate is deallocated and I still sent message to it? Could anyone teach me about this. Following is the code in scrollview did scroll method.
- (void)scrollViewDidScroll:(UIScrollView *)scrollView{
CGFloat y = scrollView.contentOffset.y;
[self.navigationController.navigationBar lt_setBackgroundColor:GWPRGBColor(255, 255, 255, ((y-100)/100.0f))];
}