I have some text fields and labels in cells in a tableView that I need to reset to empty on a button press. I cannot do this with a reloadData call and setting everything in cellForRowAtIndexPath to @"" because there are situations where the table will be reloaded and i need to retain values.
So the only option is for me to somehow loop through every textfield or label and individually set their texts to @"". But how do I access a cell, then pull out the textfield or label? keep in mind my Table also consists of different types of custom cells.
I figured it would be best to do it with tags maybe but I don't know how to access a cell's 'viewWithTag' call. If there even is such a thing.
edit added block of code where textfields are created
BaseTableViewCell *baseCell = (BaseTableViewCell *)[tableView dequeueReusableCellWithIdentifier:CellWithIdentifier];
if (baseCell == nil){
baseCell = [[BaseTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellWithIdentifier];
BaseTextField *rightText = [[BaseTextField alloc] initWithFrame:CGRectMake(150, 7, 150, 31)];
rightText.placeholder = tableValues.key;
rightText.font = [UIFont systemFontOfSize:14];
rightText.tag = (indexPath.section + 1) + (indexPath.row + 1);
rightText.delegate = self;
[baseCell addSubview:rightText];
}
NSLog(@"resetting text");
baseCell.selectionStyle = UITableViewCellSelectionStyleNone;
baseCell.backgroundColor = [UIColor clearColor];
baseCell.backgroundView = [[UIView alloc] initWithFrame:CGRectZero];
baseCell.textLabel.text = tableValues.value;
return baseCell;
}