Objective c &引用;没有重复使用的表单元格的索引路径;自定义单元格的问题

Objective c &引用;没有重复使用的表单元格的索引路径;自定义单元格的问题,objective-c,ios6,uitableview,custom-cell,Objective C,Ios6,Uitableview,Custom Cell,我有一个表视图,其中我有一个自定义单元格,其中我有另一个表视图。在这个cellforrowatinexpath方法中,我得到了一个错误没有被重用的表单元格的索引路径,单元格在滚动后消失。这是indexpath问题还是cellidentifier问题 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *Cel

我有一个表视图,其中我有一个自定义单元格,其中我有另一个表视图。在这个
cellforrowatinexpath
方法中,我得到了一个错误
没有被重用的表单元格的索引路径
单元格在滚动后消失。这是indexpath问题还是cellidentifier问题

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"CustomCell";
CustomCell *customCell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];     
//    __block CustomCell *customCell = (CustomCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
//    if (customCell == nil)
//    {
//        customCell = [[[CustomCell alloc] initWithFrame:CGRectMake(0, 0, 320, 416)] autorelease];
//   
// }
[customCell prepareCell:arrCategory];
return customCell;
}
-(void)prepareCell:(NSArray *)arrCategory
{
      if(mutArr != nil) {
        [mutArr removeAllObjects];
        mutArr = nil;
        [mutArr release];
 }
 mutArr = [[NSMutableArray alloc] arrCategory];
 [tblCusom reloadData];
}

我看了一遍,但我没有使用这个问题中使用的方法。那么,有什么问题我无法追踪。在谷歌搜索后也没有发现相同的问题如果我理解正确,您需要检查委托的调用方法的tableView(mainTableView或tblCustom)。 大概是这样的:

   - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
    {
        if (tableView == tblCusom)
        {
           __block CustomCell *categoryCell = (CustomCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
            if (customCell == nil)
            {
                customCell = [[[CustomCell alloc] initWithFrame:CGRectMake(0, 0, 320, 416)] autorelease];

            }

            [customCell prepareCell:arrCategory];
        }
        else if (tableView == self.myMainTableView)
        {
            static NSString *CellIdentifier = @"CustomCell";
            CustomCell *categoryCell = [tableView   dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
            return categoryCell;
        }

    return customCell;
}

希望它能对您有所帮助。

我很久以来也遇到过这个错误,并找到了解决方案:-

[tblCusom reloadData];
    CustomCell *categoryCell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
换成

[self performSelector:@selector(tableReloadMethod) withObject:nil afterDelay:0.5];
添加此方法:-

-(void)tableReloadMethod
{
    [tblCusom reloadData];

}
希望对你有帮助

    CustomCell *categoryCell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];

您正在创建一个单元格实例,但没有在任何地方使用它,并且该单元格正在从reuseIdentifier方法返回。因此,事实上,在您的代码中没有使用这一行

我为所有人创建了不同的类。因此,此代码在该类中,我正在使用itOk中的tableview调整我的内部单元格,请显示创建tblCustom的代码。它可能在CellForRowatineXpath中:对于主表视图。这是一个输入错误。我正在声明CustomCell对象并在preparecell方法中使用它。更新了问题非常“黑”的解决方案,如果您发现自己使用延迟来解决问题,请三思。这个答案表明这是一个已知的内部错误。