`
iaiai
  • 浏览: 2144880 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

解决自定义UITableViewCell在浏览中出现数据行重复的问题

 
阅读更多
我在写一个App的时候自定义了一个UITableViewCell,但是这个UITableView在运行的时候出现了每6行数据就循环重复显示的问题,这个问题跟android中的问题相似。。。

static NSString *CellWithIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellWithIdentifier];
if (cell == nil) {
  //这里只是创建ui界面
  UILabel* title = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 0, 0)];
        [title setTag:1];
  ...
}

//完了再这里给需要复制的项赋值就可以了,跟android里出现的问题是一样一样的
UILabel* title = [cell.contentView viewWithTag:1];
[title setText:[NSString stringWithFormat:@"高薪诚聘客服人员...%d",indexPath.row]];


开始以为ios没这问题,后来做出来没想到ios也有这问题....一直以为只有android里面有这鸟问题....
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics