Ios UITableView上的奇怪线条

Ios UITableView上的奇怪线条,ios,iphone,objective-c,uitableview,Ios,Iphone,Objective C,Uitableview,我不知道为什么会这样 这是我的代码: - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return 1; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return [thumbnails count]; } - (UITableViewCell *)


我不知道为什么会这样

这是我的代码:

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return [thumbnails count];
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *simpleTableIdentifier = @"SimpleTableCell";

    SimpleTableCell *cell = (SimpleTableCell *)[tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier];
    if (cell == nil)
    {
        NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"SimpleTableCell" owner:self options:nil];
        cell = [nib objectAtIndex:0];
    }

    cell.thumbnailImageView.image = [UIImage imageNamed:@"CamilleSeaman.jpg"];

    return cell;
}


- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 2;
}

删除heightForRowAtIndexPath委托方法后


尝试删除heightForRow的dexpath委托方法。

为什么在heightForRow中返回2?你肯定不想要一个2点高的手机。xib中的thumbnailImageView有多大?您的单元格类型是否设置为自定义?如何确定其高度?是的,它被设置为自定义!你为什么用笔尖而不是故事板?为什么你用这种古老的方式加载它而不是使用iOS4+UINib类?你检查过UITableViewCell是否真的被加载了吗?我只是跟着这个@Maximilian,你做了图像视图,你不知道你做了多大吗?您可以在“大小检查器”中查看其大小(如果正在使用这些限制,也可以查看其限制)。好的,看起来您的目的是显示缩略图,因此您可能应该替换单元格。thumbnailImageView.image=[UIImage ImageName:@“CamilleSeaman.jpg”];使用适当的代码(例如,cell.thumbnailImageView.image=thumbnail[indexPath.row];)以及添加具有正确高度的heightForRowAtIndexPath方法(如果您不使用标准高度单元格)。well。。打开名为SimpleTableCell.xib的nib文件,查看俯视图的高度。除非你用的是我怀疑的自动布局。