How can I read UITextField
value in an IBAction
? I\'m creating UITextField
programmatically. So I can\'t set @property
an
You could use something like this to loop through all UITextFields
that are subviews of self.view
and add their text to a NSMutableArray
:
for (UITextField *field in self.view.subviews) {
if ([field isKindOfClass:[UITextField class]]) {
if ([[field text] length] > 0) {
[someMutableArray addObject:field.text];
}
}
}