是的 !!!它现在工作。我创建了一个自定义单元格,它的 m 文件就像
#import "customecell.h"
@implementation customecell
@synthesize textLbl,img;
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        // Initialization code
        textLbl = [[UILabel alloc]initWithFrame:CGRectMake(15, 10, 320, 20)];
        textLbl.backgroundColor = [UIColor clearColor];
        [self.contentView addSubview:textLbl];
        img = [[UIImageView alloc]initWithFrame:CGRectMake(5, 10, 7, 11)];
        img.image = [UIImage imageNamed:@"small_arrow.png"];
        [self.contentView addSubview:img];
    }
    return self;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    // Configure the view for the selected state
}
- (void)layoutSubviews{
    [super layoutSubviews];
    float indentPoints = self.indentationLevel * self.indentationWidth;
    self.contentView.frame = CGRectMake(
                                    indentPoints,
                                    self.contentView.frame.origin.y,
                                    self.contentView.frame.size.width - indentPoints,
                                    self.contentView.frame.size.height
                                    );
}
@end
并且cellForRowAtIndexPath更改为
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    static NSString *CellIdentifier = @"Cell";
    customecell *cell = [self.tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[[customecell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
    }
    cell.textLbl.text=[[self.tabledata objectAtIndex:indexPath.row] valueForKey:@"name"];
    cell.textLbl.font = [UIFont fontWithName:@"Helvetica" size:18];
    [cell setIndentationLevel:[[[self.tabledata objectAtIndex:indexPath.row] valueForKey:@"level"] intValue]];
    cell.indentationWidth = 25;
    float indentPoints = cell.indentationLevel * cell.indentationWidth;
    cell.contentView.frame = CGRectMake(indentPoints,cell.contentView.frame.origin.y,cell.contentView.frame.size.width - indentPoints,cell.contentView.frame.size.height);
    return cell;
}