tableview刷新界面时清除旧数据

2018-08-16  本文已影响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];
        }
}
上一篇 下一篇

猜你喜欢

热点阅读