gpt4 book ai didi

ios - 滚动列表时应用程序崩溃

转载 作者:行者123 更新时间:2023-11-28 22:58:01 24 4
gpt4 key购买 nike

我已经在许多其他人身上看到过这个问题,遍历了所有主题,但我似乎无法找到解决方案。

所以我有一个普通的表格 View ,有一个链接到 .xib 文件的单元格,在第一次启动时一切看起来都很正常,但是一旦我开始滚动应用程序就会立即崩溃。

通过启用僵尸对象我遇到了这个错误:

2012-05-03 16:18:13.008 coop_dev[27547:f803] * -[ActivityTableViewController tableView:cellForRowAtIndexPath:]: message sent to deallocated instance 0x6853990

但我不确定要寻找什么或可能出现什么问题:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
ItemCell *cell = (ItemCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];

if(cell == nil)
{
NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:@"ItemCell" owner:nil options:nil];
cell = [topLevelObjects objectAtIndex:0];
}

Item *item = [self.activity objectAtIndex:indexPath.row];

[[cell projectLabel] setText:item.project];
[[cell descriptionLabel] setText:item.description];
[[cell timeLabel] setText:item.time];
[[cell timeAgoLabel] setText:item.timeAgo];
//cell.avatar = [UIImageView item.avatar];

cell.descriptionLabel.numberOfLines = 0;
[cell.descriptionLabel sizeToFit];

// remove the right arrow
cell.accessoryType = UITableViewCellAccessoryNone;

return cell;
}

它在第一次启动时运行良好,但之后就崩溃了

编辑

我在一个新项目中重新创建了这个问题,只是一个包含一些数据的基本表,一旦你开始滚动它就会崩溃。下载:http://dl.dropbox.com/u/274185/TestTable.zip

最佳答案

在您的 FirstViewController.xib 中,删除 UITableViewController,但保留 UITableView。发生崩溃是因为 File's Owner 已经在 Identity Inspector 中设置为类 FirstViewController 并且就像您有第二个 UITableViewController。还要确保 UITableView 已连接到 Controller 的 View 导出。

关于ios - 滚动列表时应用程序崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10427624/

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