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

后端 未结 9 1007
遥遥无期
遥遥无期 2020-12-23 15:29

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

9条回答
  •  一个人的身影
    2020-12-23 16:08

    If you want to remove all the subviews of a UITableViewCell you can use this code:

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

    Using the code of @leftspin

提交回复
热议问题