美文网首页
tableview刷新界面时清除旧数据

tableview刷新界面时清除旧数据

作者: 韩叨叨 | 来源:发表于2018-08-16 11:34 被阅读9次

tableview刷新界面时清除旧数据(单例的数据)

if (cell == nil) {
        cell = [[HPMTableViewCell alloc] initWithStyle:(UITableViewCellStyleValue1) reuseIdentifier:indentifier];
  }else{
        //cell中本来就有一个subview,如果是重用cell,则把cell中自己添加的subview清除掉,避免出现重叠问题
        for (UIView *subView in cell.contentView.subviews)
        {
          [subView removeFromSuperview];
        }
}

相关文章

网友评论

      本文标题:tableview刷新界面时清除旧数据

      本文链接:https://www.haomeiwen.com/subject/btvnbftx.html