I have a table with entries which the user can select and when clicking on them the UILabel should turn to a UITextField so the user can edit the value of that row.
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
if(indexPath.section == 1 &&
indexPath.row < [item.entries count])
{
ListDetailCell *tmpCell = ((ListDetailCell*)[self tableView:tvEntries cellForRowAtIndexPath:indexPath]);
tmpCell.lbTitle.hidden = true; // <- cell to hide
tmpCell.tfTitle.hidden = false; // <- textfield to show
}
}
For any reasons it seems that my changes on the controls don't get applied.
Any hints here? Thx in advance
Have you tried calling reloadRowsAtIndexPaths:withRowAnimation:
after applying your updates? Like:
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
if(indexPath.section == 1 &&
indexPath.row < [item.entries count])
{
ListDetailCell *tmpCell = ((ListDetailCell*)[self tableView:tvEntries cellForRowAtIndexPath:indexPath]);
tmpCell.lbTitle.hidden = true; // <- cell to hide
tmpCell.tfTitle.hidden = false; // <- textfield to show
//reload the cell
[tableView reloadRowsAtIndexPaths: [NSArray arrayWithObject: indexPath]
withRowAnimation: UITableViewRowAnimationNone];
}
}
In general, updates made to a displayed cell will not appear unless you explicitly tell the table to reload that cell (or to reload everything by calling reloadData
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With