
i got two different UITextfield in my iPhone application for user login. Just wondering how to validate it?

See the below given example ..that check for the string length and returns alert if the string length is greater than required one in UITextField.
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string {
if (range.location == 0 && string.length == 0) {
return YES;
}
// Build up the resulting string?
NSMutableString *fullString = [[NSMutableString alloc] init];
[fullString appendString:[textField.text substringWithRange:NSMakeRange(0, range.location)]];
[fullString appendString:string];
// Set up number formatter?
NSNumberFormatter *formatter = [[NSNumberFormatter alloc] init];
NSNumber *replaceNumber = [formatter numberFromString:fullString];
[fullString release];
[formatter release];
return !(replaceNumber == nil || [replaceNumber intValue] > 40);
}
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.