I have an iPhone SDK application that has several views that appear and disappear as the user creates content. After using the application on a device for a while, I get th
At first, delegates should be of weak/assign type. But event in this case there is a very common subtle obstacle driven by scroll animations. If you use animated content offset changes for your ScrollViews you strongly need to set its delegate to nil at dealloc method.
Otherwise you will get the following
[YourViewController respondsToSelector:]: message sent to deallocated instance
The very common example:
1. _tableView is ivar of YourViewController
2. _tableView.delegate = self;
3. - (void)scrollViewDidScroll:(UIScrollView *)scrollView is implemented at YourViewController
4. at some point you call [_tableView scrollToRowAtIndexPath:indexPath
atScrollPosition:UITableViewScrollPositionBottom animated:YES];
or [_tableView setContentOffset:CGPoint animated:YES]
and try to close YourViewController
The _tableView is retained by CoreAnimation, but YourViewController is deallocated!