I have the following code in a save method:
NSArray *cells = [tbleView visibleCells];
UITableViewCell *aCell;
UITextField *medField;
for (int i=1; i<cells.count; i++) //0 = text
{
aCell = (UITableViewCell *) [cells objectAtIndex:i];
medField = (UITextField *)[[aCell contentView] viewWithTag:i];
NSLog(@"%@", medField.text);
}
In my TableView I have 7 static cells, the first row and last rows/cells do not have text fields, cells 1-5 do have an UITextField. When I enter text in the fields the debugger shows everything is fine until I enter text in the 5th cell, then all values, which previously worked and including 5 return null. Everything is fine til I hit that 5th cell. I made sure the tag is right, tried cutting the cells.count -1, tried making i<=cells.count, it has to be something simple I am doing wrong here, but I am lost in it right now.
The answer to this question resides here:
Load all cells in UITableView before scrolling
The problem is the keyboard hides cells. Therefor the cell is not visible.
Man I hate problems like this! Hope this post can help someone else.