NSString *CellIdentifier =[NSString stringWithFormat:@"Cell-%d-%d",indexPath.section,indexPath.row]; // [NSString stringWithFormat:@"cell%@", code];
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
cell.backgroundView = nil;
}
int sect = [indexPath section];
int row =[indexPath row];
NSDictionary *dic = [contentArray objectAtIndex:sect];
// NSLog(@"dic --- %d = %@",sect, [dic objectForKey:@"Code"]);
cell.selectionStyle = UITableViewCellSelectionStyleNone;
// NSLog(@"---section =%d----row=%d",sect,row);
switch (row) {
case 0:
{
UILabel *label1 =(UILabel *)[cell viewWithTag:sect*10+100];
if (label1 == nil) {
label1 = [[UILabel alloc] initWithFrame:CGRectMake(15, 0, __MainScreen_Width/2, 44)];
label1.backgroundColor = [UIColor clearColor];
label1.font = [UIFont systemFontOfSize:12.0f];
label1.tag =100 +sect*10;
label1.textAlignment = NSTextAlignmentLeft;
[cell addSubview:label1];
}
// NSLog(@"-----label1.tag =%d",label1.tag);
UILabel *label2 =(UILabel *)[cell viewWithTag:101 + sect*10];
if (label2 == nil) {
label2 = [[UILabel alloc] initWithFrame:CGRectMake(__MainScreen_Width/2, 0, __MainScreen_Width/2-15, 44)] ;
label2.backgroundColor = [UIColor clearColor];
label2.font = [UIFont systemFontOfSize:12.0f];
label2.tag =101 + sect *10;
label2.textAlignment = NSTextAlignmentRight;
[cell addSubview:label2];
}
// NSLog(@"-----label2.tag =%d",label2.tag);
label1.text = [NSString stringWithFormat:@"%@",[dic objectForKey:@"Code"]];
label2.text = [dic objectForKey:@"Integral"];
}
break;
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
cell.backgroundView = nil;
}
int sect = [indexPath section];
int row =[indexPath row];
NSDictionary *dic = [contentArray objectAtIndex:sect];
// NSLog(@"dic --- %d = %@",sect, [dic objectForKey:@"Code"]);
cell.selectionStyle = UITableViewCellSelectionStyleNone;
// NSLog(@"---section =%d----row=%d",sect,row);
switch (row) {
case 0:
{
UILabel *label1 =(UILabel *)[cell viewWithTag:sect*10+100];
if (label1 == nil) {
label1 = [[UILabel alloc] initWithFrame:CGRectMake(15, 0, __MainScreen_Width/2, 44)];
label1.backgroundColor = [UIColor clearColor];
label1.font = [UIFont systemFontOfSize:12.0f];
label1.tag =100 +sect*10;
label1.textAlignment = NSTextAlignmentLeft;
[cell addSubview:label1];
}
// NSLog(@"-----label1.tag =%d",label1.tag);
UILabel *label2 =(UILabel *)[cell viewWithTag:101 + sect*10];
if (label2 == nil) {
label2 = [[UILabel alloc] initWithFrame:CGRectMake(__MainScreen_Width/2, 0, __MainScreen_Width/2-15, 44)] ;
label2.backgroundColor = [UIColor clearColor];
label2.font = [UIFont systemFontOfSize:12.0f];
label2.tag =101 + sect *10;
label2.textAlignment = NSTextAlignmentRight;
[cell addSubview:label2];
}
// NSLog(@"-----label2.tag =%d",label2.tag);
label1.text = [NSString stringWithFormat:@"%@",[dic objectForKey:@"Code"]];
label2.text = [dic objectForKey:@"Integral"];
}
break;