Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/17.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 有没有可能有一个';粘性';UITableViewController上的页脚?_Ios_Swift - Fatal编程技术网

Ios 有没有可能有一个';粘性';UITableViewController上的页脚?

Ios 有没有可能有一个';粘性';UITableViewController上的页脚?,ios,swift,Ios,Swift,我正在尝试构建一个结账屏幕,允许用户输入卡的详细信息等。我希望在UITableViewController的底部钉上“用Apple Pay购买”或“其他”按钮,以便它们随时可见 我知道嵌套在UIViewController中的UITableView可以实现这一点,但我只是想知道,使用UITableViewController是否可以得到类似的结果 以下是苹果商店应用程序的一个示例,显示了所需的行为。(8月18日到期)您可以使用如下表视图数据源方法: func tableView(_ tableV

我正在尝试构建一个结账屏幕,允许用户输入卡的详细信息等。我希望在
UITableViewController
的底部钉上“用Apple Pay购买”或“其他”按钮,以便它们随时可见

我知道嵌套在
UIViewController
中的
UITableView
可以实现这一点,但我只是想知道,使用
UITableViewController
是否可以得到类似的结果


以下是苹果商店应用程序的一个示例,显示了所需的行为。(8月18日到期)

您可以使用如下表视图数据源方法:

func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
    // Write your code for sticky design 
}

func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
    return 100
}

这可能会对您有所帮助。谢谢。

不使用
UITableViewController
和使用常规的
UIViewController
并手动添加表视图的原因有很多,这就是其中之一。实际上,
UITableViewController
的唯一真正原因是当您希望使用静态单元格而不是动态原型时。

将UITableViewController移动到嵌入式视图中可能是值得的。这样,您就可以在表视图的底部覆盖任何您喜欢的内容。

tableFooterView
将仅在最后一个单元格之后可见。此问题没有现成的解决方案。如果要添加节页脚,则可能会遇到两个问题,即如果有多个节,以及当内容小于tableview的高度时。唯一可行的解决方案是在tableview上方添加一个
UIView

您可以通过在tableview控制器ui视图上添加一个额外视图来实现。为此,您必须获得“注意”视图层次结构。

谢谢,但对我来说,这一点的问题是,只有当节的高度大于可用区域时,它才位于屏幕底部。理想情况下,我希望它无论如何都保持在底部。