I have a UITextField on a UITableViewCell and a button on another cell.
I click on UITextField (keyboard appears).
UITextField has the following method:
- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField { NSLog(@"yes, it being called"); owner.activeTextField = textField; return YES; };
If owner.activeTextField is a (conservation, non-atomic) property.
Problem When the keyboard is visible, I am viewing a cell from the view. Then I press the button located on another cell. The button calls:
[owner.activeTextField resignFirstResponder]
And that calls EXC_BAD_ACCESS.
Any idea? The cell is definitely in memory. My assumption is that as soon as it disappears, it is removed from the view, and one of its properties (parent view?) Becomes zero and causes the indicated error.
I'm right?
TL DR; How to remove the keyboard (cancel the first responder) when the UITextField is removed from the view?
source share