Reputation: 111
When the user click on the textField i send them to another screen (using Editing did begin) so he can select the option he wants (i use the textfield for design purpose so i cant change this for a button or pickerView or etc)
The question is, when he selects the option he wants i pop this view and send the value back to the textField screen (using delegate).
Now i tried to do textField.resignFirstResponder()
but this does not work, since the textField is still selected the action goes into a loop. I can use textField.isDisable
but the user can't change the value anymore.
I can fix this by simple putting
if(textField.text != "")
{
return
}
In the textField action. But this is far away from a solution, its more like band-aid on a leak.
And with this if the user select the textField again since i have the if above in the code he will not go to the select screen unless he delete the entire text.
How can i solve this? Since resignFirstResponder
its not working. Maybe im doing it wrong?
Upvotes: 0
Views: 425
Reputation: 1442
Please set Delegate for your textfield
textFieldName.delegate = self
Upvotes: 1