Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/95.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 如何保持页脚在底部,UITableView_Ios_Objective C_Iphone_Xcode_Uitableview - Fatal编程技术网

Ios 如何保持页脚在底部,UITableView

Ios 如何保持页脚在底部,UITableView,ios,objective-c,iphone,xcode,uitableview,Ios,Objective C,Iphone,Xcode,Uitableview,这就是我的未填充UITableView的外观: 如果我滚动足够多,页脚就会出现这种情况: 正如你所看到的,当我向下滚动时,页脚正在向上移动。当tableview中填充了更多的单元格时,滚动的数量明显减少,这使得这种情况更加频繁。有没有办法让它一直保持在第一张照片中的样子 我用于页脚的代码如下所示: -(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section { UIView

这就是我的未填充UITableView的外观:

如果我滚动足够多,页脚就会出现这种情况:

正如你所看到的,当我向下滚动时,页脚正在向上移动。当tableview中填充了更多的单元格时,滚动的数量明显减少,这使得这种情况更加频繁。有没有办法让它一直保持在第一张照片中的样子

我用于页脚的代码如下所示:

-(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
{
    UIView* view = [UIView new];
    [view setBackgroundColor:[UIColor grayColor]];
    return view;
}

-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
{
    return 1.0f;
}

不使用表页脚视图,您可以将页脚作为一个单元格添加到末尾,就像添加自定义单元格一样。在cellForRow方法中,您可以检查indexPath.row并决定是显示页脚单元格还是显示普通单元格。的可能重复