Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/xpath/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 某些(自定义)单元格不在UITableView中渲染_Ios_Objective C_Uitableview - Fatal编程技术网

Ios 某些(自定义)单元格不在UITableView中渲染

Ios 某些(自定义)单元格不在UITableView中渲染,ios,objective-c,uitableview,Ios,Objective C,Uitableview,我有一个自定义单元格的UITableView。大多数单元格绘制正确。但有些单元格渲染一小段时间(毫秒),然后单元格内的内容消失 对于我的cellForRowAtIndexPath,我为每个单元格创建了一个唯一的标识符,以供重用。这是我使用的标识符: NSString *CellIdentifier = [NSString stringWithFormat:@"%d_%d",indexPath.section,indexPath.row]; 通过这种方式,我保证使用CellForRowatine

我有一个自定义单元格的UITableView。大多数单元格绘制正确。但有些单元格渲染一小段时间(毫秒),然后单元格内的内容消失

对于我的cellForRowAtIndexPath,我为每个单元格创建了一个唯一的标识符,以供重用。这是我使用的标识符:

NSString *CellIdentifier = [NSString stringWithFormat:@"%d_%d",indexPath.section,indexPath.row];
通过这种方式,我保证使用CellForRowatineXpath在滚动后将返回正确的单元格,因为UITableView正在重用正确的单元格

我的问题是:什么会导致一个单元格在短时间内渲染然后消失? 某些单元格超出指定空间可能是尺寸问题吗

感谢您提供有助于解决此问题的任何信息

编辑行的单元格代码:

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
   NSString *CellIdentifier = [NSString stringWithFormat:@"%d_%d",indexPath.section,indexPath.row];
CustomTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if(!cell){
    [tableView registerNib:[UINib nibWithNibName:@"CustomCell" bundle:nil] forCellReuseIdentifier:CellIdentifier];
    cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    cell.label.text=@"TEST":
}




return cell;

}

不要为每行使用不同的标识符。标识符用于重用,那么如果每个单元格都有不同的标识符,那么就没有使用标识符的必要为什么不呢?我有一份短名单。在滚动时,它能很好地保持顺序。在索引处发送行的单元格代码只是为了获取知识,取1000个单元格,并为每个单元格使用不同的标识符,然后查看内存。然后你会发现差异。我相信这将对大列表产生很大的差异。我的名单将比1000小得多。