I've got a UITextField, and when text gets entered into that, I want to obtain the doubleValue from the text field and perform some computations and display them in a UITableView.
The delegate for the UITextField adopts the UITextFieldDelegate protocol, and implements both textFieldShouldReturn: and textFieldDidEndEditing: methods. textFieldShouldReturn: resigns first responder status which, according to docs should also trigger textFieldDidEndEditing:, but I never see textFieldDidEndEditing: called.
- (BOOL)textFieldShouldReturn:(UITextField*)theTextField {
if (theTextField == thresholdValue) {
[thresholdValue resignFirstResponder];
}
return YES;
}
- (void)textFieldDidEndEditing:(UITextField *)textField {
[self updateThresholdValue:textField];
}
It may be worth noting that I also tried connecting some of the textfield events to the delegate and having the event call updateThresholdValue: directly, but that didn't work either.
textFieldDidEndEditing is fired when the textfield resigns it's first responder status while textFieldShouldReturn is fired when the return button is pressed.
It sounds like your textfield is never resigning as firstResponder. You can check it pretty easily by putting some debug output (as suggested in the comments) and just navigating out of the textfield with a touch - eg start typing then just touch outside of the field to force it to resign firstResponder.
Not sure if that helps a lot, but it sounds like a strange case you are hitting.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With