static NSString *timeStr = @"MessageCellTime";
if (indexPath.row < [self.dataSource count]) {
id obj = [self.dataSource objectAtIndex:indexPath.row];
if ([obj isKindOfClass:[NSString class]]) {
EMChatTimeCell *timeCell = (EMChatTimeCell*)[tableView dequeueReusableCellWithIdentifier:timeStr];
if (timeCell == nil) {
timeCell = [[EMChatTimeCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:timeStr];
timeCell.backgroundColor = [UIColor clearColor];
timeCell.selectionStyle = UITableViewCellSelectionStyleNone;
}
dispatch_async(dispatch_get_main_queue(), ^{
timeCell.textLabel.text = (NSString*)obj;
});
//timeCell.textLabel.text = (NSString*)obj;
return timeCell;
}
else
{
MessageModel *model = (MessageModel*)obj;
NSString *cellIndentifier = [EMChatViewCell cellIdentifierForMessageModel:model];
EMChatViewCell *cell = (EMChatViewCell*)[tableView dequeueReusableCellWithIdentifier:cellIndentifier];
if (cell == nil) {
cell = [[EMChatViewCell alloc]initWithMessageModel:model reuseIdentifier:cellIndentifier];
cell.backgroundColor = [UIColor clearColor];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
}
return cell;
ARC已启用。自从我弹出后,ViewController调用dealloc,但我的customCell如EMChatTimecell和EMChatViewCell并未将其称为dealloc,感谢您的帮助。
答案 0 :(得分:0)
当您具有强大的参考周期时,这通常是一个问题。其中一种可能性是您的委托或dataSource对象被声明为强而不是弱。 请阅读本文 - &gt; Apple memory management guide。即使使用弧线,你应该对内存管理有一个公平的想法,它有助于在强大的参考周期等紧张的情况下。