Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

[UITableViewCell _didChangeToFirstResponder:]: message sent to deallocated instance

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

like image 634
vasu Avatar asked Dec 24 '13 07:12

vasu


1 Answers

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];
}
like image 173
Warrior Avatar answered Nov 23 '22 23:11

Warrior