I have lot of text fields statically placed in static TableViewcells. How can access the text in it without creating referencing outlet for each textfield? I have tried taking subviews of cell. It’s not working. Any alternatives?
I tried this. It’s not working.
- (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [super tableView:tableView
cellForRowAtIndexPath:indexPath];
for (UIView *subview in [cell subviews]){
if([subview isKindOfClass:[UITextField class]]){
UITextField *inputField = (UITextField *)subview;
NSLog(@"%@",inputField.text);
}
}
return cell;
}
You could use an IBOutletCollection. That lets you connect them all to one array, where you can access them by index, or use setValue:forKey: to address them all at once.