gpt4 book ai didi

ios - ***断言失败-[UITableView _configureCellForDisplay :forIndexPath:]

转载 作者:IT王子 更新时间:2023-10-29 08:21:51 25 4
gpt4 key购买 nike

我在我的项目中使用tableview apple 的延迟加载代码,但在项目中出现异常。错误是 - *** Assertion failure in -[UITableView _configureCellForDisplay:forIndexPath:],这是我的代码,请帮忙。但它在其他项目中工作。我没有委托(delegate)方法。

   - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"LazyTableCell";
static NSString *PlaceholderCellIdentifier = @"PlaceholderCell";

NSUInteger nodeCount = [self.entries count];

if (nodeCount == 0 && indexPath.row == 0)
{
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:PlaceholderCellIdentifier];
cell.detailTextLabel.text = @"Loading…";

return cell;
}

UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

if (nodeCount > 0)
{
AppRecord *appRecord = [self.entries objectAtIndex:indexPath.row];

cell.textLabel.text = appRecord.name;


if (!appRecord.appIcon)
{
if (self.mytable_view.dragging == NO && self.mytable_view.decelerating == NO)
{
[self startIconDownload:appRecord forIndexPath:indexPath];
}

cell.imageView.image = [UIImage imageNamed:@"Placeholder.png"];
}
else
{
cell.imageView.image = appRecord.appIcon;
}

}

return cell;

}

最佳答案

因为 cellForRowAtIndexPath 返回一个 nil 值,然后 configureCellForDisplay 需要一个 UITableViewCell。 Storyboard或 XIB 没有使用您指定的单元格标识符定义的单元格。最好检查标识符的拼写。

关于ios - ***断言失败-[UITableView _configureCellForDisplay :forIndexPath:],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20139259/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com