Просто сделай так ..................
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *celltype=@"cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:celltype];
for (UIView *view in cell.contentView.subviews) {
[view removeFromSuperview];
}
if (cell == nil)
{
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cell"] autorelease];
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
cell.backgroundColor=[UIColor clearColor];
//cell.textLabel.text=[[resultarray objectAtIndex:indexPath.row] valueForKey:@"Service"];
cell.backgroundView=[[[UIImageView alloc]initWithImage:[UIImage imageNamed:@"cell.png"]]autorelease];
// [[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"back.png"]] autorelease];
cell.selectionStyle=UITableViewCellSelectionStyleNone;
}
UILabel *productCodeLabel = [[UILabel alloc] initWithFrame:CGRectMake(105, 7, 60,20 )];
productCodeLabel.textColor = [UIColor whiteColor];
productCodeLabel.backgroundColor=[UIColor clearColor];
productCodeLabel.text=[NSString stringWithFormat:@"%@",@"Code"];
[cell.contentView addSubview:productCodeLabel];
[productCodeLabel release];
UILabel *CodeValueLabel = [[UILabel alloc] initWithFrame:CGRectMake(170, 7, 140,20 )];
CodeValueLabel.textColor = [UIColor whiteColor];
CodeValueLabel.backgroundColor=[UIColor clearColor];
CodeValueLabel.text=[NSString stringWithFormat:@"%@",[[productArray objectAtIndex:indexPath.row]valueForKey:@"ID"]];
[cell.contentView addSubview:CodeValueLabel];
[CodeValueLabel release];
UILabel *productNameLabel = [[UILabel alloc] initWithFrame:CGRectMake(105, 35, 60,20 )];
productNameLabel.textColor = [UIColor whiteColor];
productNameLabel.backgroundColor=[UIColor clearColor];
productNameLabel.text=[NSString stringWithFormat:@"%@",@"Name"];
[cell.contentView addSubview:productNameLabel];
[productNameLabel release];
UILabel *NameValueLabel = [[UILabel alloc] initWithFrame:CGRectMake(170, 35, 140,20 )];
NameValueLabel.textColor = [UIColor whiteColor];
NameValueLabel.backgroundColor=[UIColor clearColor];
NameValueLabel.text=[NSString stringWithFormat:@"%@",[[productArray objectAtIndex:indexPath.row]valueForKey:@"Title"]];
[cell.contentView addSubview:NameValueLabel];
[NameValueLabel release];
UILabel *dateLabel = [[UILabel alloc] initWithFrame:CGRectMake(105, 68, 60,20 )];
dateLabel.textColor = [UIColor whiteColor];
dateLabel.backgroundColor=[UIColor clearColor];
dateLabel.text=[NSString stringWithFormat:@"%@",@"Date"];
[cell.contentView addSubview:dateLabel];
[dateLabel release];
UILabel *dateValueLabel = [[UILabel alloc] initWithFrame:CGRectMake(170, 68, 140,20 )];
dateValueLabel.textColor = [UIColor whiteColor];
dateValueLabel.backgroundColor=[UIColor clearColor];
dateValueLabel.text=[NSString stringWithFormat:@"%@",[[productArray objectAtIndex:indexPath.row]valueForKey:@"PostedDate"]];
dateValueLabel.font=[UIFont systemFontOfSize:14];
dateValueLabel.numberOfLines=3;
dateValueLabel.adjustsFontSizeToFitWidth=YES;
[dateValueLabel setLineBreakMode:UILineBreakModeCharacterWrap];
[cell.contentView addSubview:dateValueLabel];
[dateValueLabel release];
/*
UILabel *DetailLabel = [[UILabel alloc] initWithFrame:CGRectMake(185, 15, 100,20 )];
DetailLabel.textColor = [UIColor blackColor];
DetailLabel.backgroundColor=[UIColor clearColor];
[cell.contentView addSubview:DetailLabel];
[DetailLabel release];*/
return cell;
}
У меня есть массив с ключами, поэтому я также использую ключ. Но если у вас просто есть массив без ключей. Тогда вам не нужно писать ValuForKey: @ "Id", вы можете пропустить значение для ключа. Вам поможет, я дал вам полный код.