I’m trying to implement custom AlertView.
The idea is to have alertview with textfield and cancel button.
What i can’t do is to check textfield live for entered characters. I know i can do it using – alertViewShouldEnableFirstOtherButton: but i don’t want another button. I wish to do the same just without button.
In android you can add listeners to textfields onchange.
Tried to do it using this uitextfield function, but it doesn’t get called live or maybe i’m using it in a wrong way.
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string
{
textField = [alert textFieldAtIndex:0];
if ([textField.text length] == 0)
{
NSLog(@"Hello");
return NO;
}
return NO;
}
So how to do this properly?
try this
and textfield method