I am new to iOS. I have a viewcontroller for registration, it contains three UITextfields for Email,password, Confirm password and a UIButton. I have some validations, On success of those validation I have to enable signup button. I have implemented it through shouldChangeCharactersInRange, But it returns me old characters e.g.
I type a => It returns me ""
then
I type ab => It returns a
then
I remove b => It returns me ab
In actual it is:
-(BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string {
if ([textField.text length]>0) {
[self enableSignUpButton];
}
return YES;
}
-(void)enableSignUpButton {
if ([emailTextField.text length]>0 && [passwordTextfield.text length]>0 && [confirmPasswordTextfield.text length]>0)
signUpButton.enabled=TRUE;
return;
}
signUpButton.enabled=FALSE;
}
It is not getting the textfield value dynamically I think ? or ?
Help me to get out of this.