// Detect empty fields
-(BOOL) detectEmptyTextFields {
UITextField *temp = (UITextField *)[self.Control1 viewWithTag:12];
//Remove whitespaces if any in string
NSCharacterSet *whitespace = [NSCharacterSet whitespaceCharacterSet];
NSString *trimmedString = [temp.text stringByTrimmingCharactersInSet:whitespace];
NSLog(@"Value of the text field is %@",trimmedString);
if (([trimmedString isEqualToString:@""])) {
return YES;
}
NSLog(@"temp.text : %@",temp.text);
if ([temp.text isEqualToString:@""] || temp.text==nil) {
return YES;
}
return NO;
}
No comments:
Post a Comment