Reputation: 9551
I have 8 NSTextFields and I need to access them by UI to determine if the NSTextField has any data. If it's empty then I mark a bool as NO and check the next field. Eventually I'll highlight all the required fields and present it to the user.
Here's my pseudocode
-(BOOL)isFormValid
{
for(int i=0; i< 9; i++)
{
if <tag>.text != nil or <tag>.text != @"" then
return NO
}
return YES;
}
Upvotes: 1
Views: 121
Reputation: 64022
Why don't you use an NSForm
? As the name suggests, it's designed for text forms. You have one outlet to the form as a whole and can get each field in the form with cellAtIndex:
Upvotes: 0