Reputation: 81
I added textfield to tableview cell contentview.when i'm editing any textfield and i scrolled the tableview to bottom and dismiss the keyboard Then app crashed ,because of this reason [UITableViewCell _didChangeToFirstResponder:]: message sent to deallocated instance
Upvotes: 8
Views: 1290
Reputation: 39384
Try to hide the keyboard while scrolling.
In h class Declare a textfield
UITextField *selectedTextField;
In m class
- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField
{
selectedTextField = textField;
return YES;
}
I also had the same problem. The above solution fixed it.
All the best.
- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView {
[selectedTextField resignFirstResponder];
}
Upvotes: 6