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

后端 未结 9 1018
遥遥无期
遥遥无期 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:12

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

提交回复
热议问题