Any idea on how to reset a UITableView
?
I want to display a new set of data at the press of a button and also remove all the subviews from the cell's contentView
and refresh them with a new set of subviews. I tried [tableView reloadData]
but the data did get refreshed but the subviews added to the contentView
of the cells previously persisted.
Better yet, when you create the cell:
#define MY_CUSTOM_TAG 1234
mySubview.tag = MY_CUSTOM_TAG;
[cell.contentView addSubview:mySubview] ;
And later on, when you need to remove it:
[[cell.contentView viewWithTag:MY_CUSTOM_TAG]removeFromSuperview] ;
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