cell 变动

来源:互联网 发布:xampp linux 安装 编辑:程序博客网 时间:2024/04/28 06:50

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{    static NSString *CellIdentifier = @"Cell";    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];    if (cell==nil) {        cell=[[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier]autorelease];        UILabel *label1=[[UILabel alloc]initWithFrame:CGRectZero];        label1.tag=1;        label1.lineBreakMode=UILineBreakModeWordWrap;        label1.highlightedTextColor=[UIColor whiteColor];        label1.numberOfLines=0;        label1.opaque=NO;        label1.backgroundColor=[UIColor clearColor];        [cell.contentView addSubview:label1];        [label1 release];    }    // Configure the cell...    UILabel *label1=(UILabel*)[cell viewWithTag:1];    Status *sts=[array objectAtIndex:indexPath.row];    Status *restst=[sts retweetedStatus];    NSString *text=[sts text];    CGRect cellFrame=[cell frame];    cellFrame.origin=CGPointMake(0, 0);    label1.text=text;    CGRect rect=CGRectInset(cellFrame, 2, 2);    label1.frame=rect;    [label1 sizeToFit];    if (label1.frame.size.height>46) {        cellFrame.size.height=50+label1.frame.size.height-46;    }else{        cellFrame.size.height=50;    }    [cell setFrame:cellFrame];    return cell;}