It's strange... I've added a property for doneButton (and synthesize) and it worked, then I remove the property, coming back to the old code and it works also so. But now I've another problem. This code:
Code:
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string {
if (textField == password) {
if (textField.text.length > 0) {
doneButton.enabled = YES;
} else {
doneButton.enabled = NO;
}
}
return YES;
}
enables the button when the text length is >0, but it disables the button when the chars are 0 and 2.
I don't understand this behaviour.