tableviewcell重绘

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;

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值