I am working this on Xcode 4.3 target iOS5 for iPhone.
I have View B which is segue-ed from View A using simple button action. In View B have text field and I need this text field input validated. The validation rule is simple: if the text field is empty then textFieldShouldEndEditing return NO. The code is:
- (BOOL)textFieldShouldEndEditing:(UITextField *)textField
{
if (![textField.text length]) {
return NO;
}
return YES;
}
This working fine. However, if I have not input anything and 'back' button is pushed (which is pop the view controller) return to View A and I push the button again in View A to navigate to View B, the view B is completely disabled and I can not edit anything in the text field. This is not the case when the validation is not implemented OR always return YES. I also tried if I input something but textFieldShouldEndEditing always return NO;
I trace the code and notice that the textFieldShouldEndEditing is also fired if the controller pop-ed. I think the problem is something to do with thins setting textFieldShouldEndEditing set to YES or NO, but I completely confused.
Please help...