创建一个表视图,这根本没有意义,但是我的表视图隐藏了一些单元格。

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    // Return the number of sections.
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    // Return the number of rows in the section.
    return 25;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"Cell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if(cell==nil){
        cell= [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"Cell"];
    }
    object= [self.results objectAtIndex:indexPath.row];
    cell.textLabel.text=[object valueForKey:@"hLabel"];
    return cell;
}


它确实可以渲染25个单元格,但我最多只能查看23个。下面隐藏了2个单元格。虽然如果我进一步滚动可以看到它们,但是如果我离开滚动,则视图将返回,第23个单元格是最后一个单元格。因此,用户无法选择24或25。
即使我减少了单元格的数量,可以说是23个,但tableview仍隐藏了2个单元格,并且由于滚动在2个单元格之前结束,所以我无法访问它们。

最佳答案

我遇到了类似的问题,我不知道如何解决,但是当我取消选中“自动版式”时,该问题就解决了。尝试关闭自动版式。我希望它也对您有帮助。

关于ios - uitableview从滚动中隐藏2个单元格,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/20996678/

10-14 19:55
查看更多