Did anyone notice that UITextField
calls textFieldDidEndEditing
after clear button is pressed but text
property still has old data ?
I'm not sure what code-sample I can provide here. I'm using storyboard if that matters.
For now I have to rely on taking data from all edit controls on main form's "Submit" button. But ideally I'd prefer to collect data in textFieldDidEndEditing
handler.
Are there any better workarounds ?
I'm on iOS 6.
Update: Basically here is what I have on the form
UITextField
andUiButton
are on the form.- Keyboard dimissed by calling
resignFirstResponder
in handler ofUITapGestureRecognizer
Steps to reproduce the issue:
- Click on edit control. Enter some text.
- Tap outside of text control.
textFieldDidEndEditing
is called. Property.text
has value I entered. All good.- Click on edit control again.
- Click on clear button.
textFieldDidEndEditing
is called again. But property.text
still has value I just deleted !- Now as you see cursor blinking inside UITextField tap on Button on the form.
- Keyboard is dismissed by
textFieldDidEndEditing
was never called.
I'll upload sample project on GitHub tomorrow.