好吧,也许我太挑剔了。如果你看不到它,提前道歉,但在第二张图片中,行中的项目有点像素化,或者好像一个词放在一个单词的顶部。这只发生在我向上滚动tableview之后,否则,它与第一个图像相似。UITableview项目滚动后变粗体
第一张图:
第二张图(你可以在这里看到在字体的差异):
它更大胆出位和不登大雅之堂,一旦我向上滚动。
我坦率地不知道为什么。 tableview正在正常加载。任何帮助,预感或建议都会非常相关,即使它可以指向正确的区域。
这是第二张图片的tableview代码。
static NSString *CellIdentifier = @"OrderProductCell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:CellIdentifier] autorelease];
}
//cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:CellIdentifier] autorelease];
//configure cell, display name and cost of each item
OrderProduct *p = [[order.items allObjects] objectAtIndex:indexPath.row];
UILabel *lableName=[[UILabel alloc]initWithFrame:CGRectMake(10, 16, 300, 20)];
lableName.backgroundColor=[UIColor clearColor];
lableName.font=[UIFont boldSystemFontOfSize:19];
[lableName setFont:[UIFont fontWithName:@"Arial-Bold" size:12.0]];
lableName.text=p.name;
//UILabel *counterNumber=[[UILabel alloc]initWithFrame:CGRectMake(10, 25, 300, 20)];
//counterNumber.backgroundColor=[UIColor clearColor];
//counterNumber.font=[UIFont systemFontOfSize:12];
//counterNumber.text=[NSString stringWithFormat:@"Scan time :%@",p.scannerCounter];
[cell.detailTextLabel setText:[NSString stringWithFormat:@"%@ %.02f",p.currency, p.cost]];
cell.imageView.image = [UIImage imageNamed:p.image];
[cell addSubview:lableName];
//[cell release];
//[cell addSubview:counterNumber];
return cell;
显示'cellForRowAtIndexPath'方法的代码。 – rmaddy
@rmaddy添加了它。 – user3255500
不直接将标签添加到单元格,将其添加到单元格的内容视图 –