Ios 为什么我的自定义UITableviewCell可以';你不打电话给Dealoc? static NSString*timeStr=@“MessageCellTime”; if(indexath.row。即使在使用arc时,您也应该对内存管理有一个合理的认识,它在诸如强引用周期之类的紧张情况下很有帮助。感谢您的回复。我知道我的单元格没有释放可能是您所说的原因。但我就是找不到它发生的地方。您能发布一些您声明委托和数据源的代码吗rce?或其他一些有用的代码。其他情况可能是你在一个块中捕获自我。发布一些代码以获得更精确的答案。由于代码太多,我更改了页面,请单击此处。谢谢。 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。这通常是一个问题,当您有一个强引用循环时。其中一种可能是委托或数据源对象被声明为强对象弱者的广告。Ios 为什么我的自定义UITableviewCell可以';你不打电话给Dealoc? static NSString*timeStr=@“MessageCellTime”; if(indexath.row。即使在使用arc时,您也应该对内存管理有一个合理的认识,它在诸如强引用周期之类的紧张情况下很有帮助。感谢您的回复。我知道我的单元格没有释放可能是您所说的原因。但我就是找不到它发生的地方。您能发布一些您声明委托和数据源的代码吗rce?或其他一些有用的代码。其他情况可能是你在一个块中捕获自我。发布一些代码以获得更精确的答案。由于代码太多,我更改了页面,请单击此处。谢谢。 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;,ios,Ios,ARC已启用。自从我弹出后,ViewController被称为dealloc,但由于帮助我,我的customCell(如EMChatTimecell和EMChatViewCell)没有将其称为dealloc。这通常是一个问题,当您有一个强引用循环时。其中一种可能是委托或数据源对象被声明为强对象弱者的广告。 请阅读此->。即使在使用arc时,您也应该对内存管理有一个合理的认识,它在诸如强引用周期之类的紧张情况下很有帮助。感谢您的回复。我知道我的单元格没有释放可能是您所说的原因。但我就是找不到它发生
请阅读此->。即使在使用arc时,您也应该对内存管理有一个合理的认识,它在诸如强引用周期之类的紧张情况下很有帮助。感谢您的回复。我知道我的单元格没有释放可能是您所说的原因。但我就是找不到它发生的地方。您能发布一些您声明委托和数据源的代码吗rce?或其他一些有用的代码。其他情况可能是你在一个块中捕获自我。发布一些代码以获得更精确的答案。由于代码太多,我更改了页面,请单击此处。谢谢。
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;