Cocoa touch 什么';iOS 3.0和UtableViewCell的numberOfLines=0有什么问题?

Cocoa touch 什么';iOS 3.0和UtableViewCell的numberOfLines=0有什么问题?,cocoa-touch,uitableview,multiline,ios3.0,Cocoa Touch,Uitableview,Multiline,Ios3.0,好的,事情是这样的,两天来,我们一直在努力构建一个具有字幕风格的像样的tableview单元格 所以我重写了“tableview:HeightForRowatinex:”方法。好的 我还将详细信息的numberoflines设置为0 这在ios4.0中运行良好 但对于ios 3.0来说,情况并非如此 textlabel和detailtextlabel的顶部似乎有一定的边距,将所有单元格内容向下推,使其与下面的单元格重叠。 这是疯狂的行为。我找不到在其内容视图中设置textlabel/detail

好的,事情是这样的,两天来,我们一直在努力构建一个具有字幕风格的像样的tableview单元格

所以我重写了“tableview:HeightForRowatinex:”方法。好的 我还将详细信息的numberoflines设置为0

这在ios4.0中运行良好

但对于ios 3.0来说,情况并非如此 textlabel和detailtextlabel的顶部似乎有一定的边距,将所有单元格内容向下推,使其与下面的单元格重叠。 这是疯狂的行为。我找不到在其内容视图中设置textlabel/detailtextlabel位置的方法

请帮忙。 这家伙说他要实施自己的控制。但是那太多的工作了,对我来说很难。 一定有人已经知道如何绕过这个问题。
谢谢

事实上,苹果公司的员工似乎并没有像普通开发者所希望的那样,真正让uitableviewcell具有可定制性

所以你必须自己定制它。 自从那时起,我没有时间覆盖UITableViewCell并实现我的自定义单元

我做得很匆忙。通过

UITableViewCell *cell = [_tableView dequeueReusableCellWithIdentifier:@"cell"];

if( nil == cell ) {     
    cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"cell"] autorelease];

    //contentview
    UIImageView * imageView = [[UIImageView alloc]initWithFrame:CGRectMake(1, 5, 11, 9)];
    imageView.image=_headerImage;

    UILabel* textLabel=[UILabel new];
        UILabel* detailTextLabel=[UILabel new];

//get and set the size of the labels here 

        textLabel.font=_font;
    detailTextLabel.font=_fontD;
    textLabel.numberOfLines=0;
    detailTextLabel.numberOfLines=0;

    textLabel.backgroundColor=[UIColor clearColor];
    detailTextLabel.backgroundColor=[UIColor clearColor];

    textLabel.tag=202;
    detailTextLabel.tag=203;
    imageView.tag = 204;

    [cell.contentView addSubview:imageView];
    [cell.contentView addSubview:textLabel];
    [cell.contentView addSubview:detailTextLabel];
    [textLabel release];
    [detailTextLabel release];
    [imageView release];
}
当然,在实施过程中

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{   
    if(!_cellTitleSizes)
    {
        _cellTitleSizes= [NSMutableArray new];
        _cellDetailSizes= [NSMutableArray new];
    }

    MenuItem *tempItem =[self GetItemFromIndexPath:indexPath];

    CGSize size = [ tempItem.title sizeWithFont:_font constrainedToSize:_textSize lineBreakMode:UILineBreakModeWordWrap];
    CGSize size2 = [[MenuListViewController GetDetailsToDisplay:tempItem] sizeWithFont:_fontD constrainedToSize:_textSize lineBreakMode:UILineBreakModeWordWrap];

    //the following information will be used to set the title and description labels in the cell.
    [_cellTitleSizes addObject:[NSValue valueWithCGSize:size]];
    [_cellDetailSizes addObject:[NSValue valueWithCGSize:size2]];   

    return MAX( (size.height+size2.height)+ 30, 44.0f );
}
祝大家好运