I have an array of text fields. I'm using a for
loop to go through the array and check to see if the text field's text attribute is empty.
NSArray *arrayOfTextFields = [NSArray arrayWithObjects: _nameTextfield, _emailTextfield, _phoneTextfield, _termTextfield, _schoolTextfield, _graduationTextfield, _gpaTextfield, _degreeTextfield, _interestTextfield, _groupTextfield, _appliedTextfield, nil];
for (int i = 0; i < [arrayOfLabels count]; i++) {
if ([[arrayOfTextFields objectAtIndex:i] isEqualToString:@""]) {
NSLog(@"if statement ran");
}
}
Obviously the if
statement does not run because it is comparing a text field to a string. I can't figure out how to do this syntactically in Objective-C. Something like this would be incredibly easy in C++ or Java, it might look something like arrayOfTextFields[i].text == "";
That is essentially what I'm trying to do. I have struggled to find references to the sort of thing online.