I have a textField here, and I tap it so it become the first responder,
then I leave it without inputting anything, which i think means the textField.text remains nil.
And its delegate will go to this method:
- (BOOL)textFieldShouldEndEditing:(UITextField *)textField {
if (textField.text == nil)
return YES;
...
}
and it just does not execute the return inside the IF!!
You can use ‘isEqualToString:’
Try this
Or just check the length