remove the subviews from the contentView of UITableViewCell (reset the UITableView)

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] ;

I got the answer :)

if ([cell.contentView subviews]) {
    for (UIView *subview in [cell.contentView subviews]) {
        [subview removeFromSuperview];
    }
}

This piece of code will check if the cell's content view has any subviews.
If there are any, it removes them as the for loop iterates!


Instead of iterating through all the subviews (yourself) to remove them, you can simply do this,

[[scrollView subviews] makeObjectsPerformSelector:@selector(removeFromSuperview)];