我有以下代码,它为UITableViewCell绘制分隔线和文本。它看起来很好,但当我滚动屏幕然后返回时,分隔线已消失,但文本仍然正常。有任何想法吗?重复使用UITableViewCell问题
static NSString *aProgressIdentifier = @"CustomerCell";
UITableViewCell *aCustomerCell = [iTableView dequeueReusableCellWithIdentifier:aProgressIdentifier];
if (!aCustomerCell) {
aCustomerCell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:aProgressIdentifier] autorelease];
aCustomerCell.contentView.backgroundColor = [UIColor whiteColor];
UIImageView *aLine = [[UIImageView alloc] initWithFrame:CGRectMake(0, 72, 800, 1)];
aLine.backgroundColor = [UIColor colorWithWhite:0.9 alpha:1.0];
[aCustomerCell addSubview:aLine];
[aLine release];
}
CMACustomer *aCustomerObject = aCellObject;
aCustomerCell.textLabel.text = aCustomerObject.customerFullName;
aCustomerCell.detailTextLabel.text = nil;
aCell = aCustomerCell;
雅的高度恰好是72,并且该线最初显示,这意味着它的工作原理。我试过你发布的第二个代码,但它只给我所有没有文本或任何东西的灰色单元格。 – Jon 2012-02-21 21:16:27
我实际上已将行改为71,现在所有作品。奇怪。 – Jon 2012-02-21 21:39:19