如何在故事板中添加脚注到 UITableView

我是 iOS 开发的新手。

我想在 UITableViewController中为表视图添加一个页脚。我已经制作了我想用作故事板页脚的视图,但是我不知道如何将它作为我的表视图的页脚。

我可以通过分配 self.tableView.tableFooterViewUITableViewControllerviewDidLoad方法中以编程方式添加页脚。但是我已经在 Storyboard 中创建了我的页脚视图,那么 最佳实践将它作为页脚添加到我的表视图中的方式是什么呢?

52675 次浏览

You can just drag a view to the bottom area of the tableView. You'll see in the hierarchy that it will be a subview of the tableview. You can then drag subviews such as labels and buttons there, adjust the height, etc.

The above answer worked for me with one twist. I found I couldn't add a footer if the cells filled up the entire height of the table view. Removing a couple of cells allowed me to add the footer, after which I was able to add the cells back.

Very simple!. dbrajkovic solution but in a graphical way. Just add a view to the table view.That's all!. enter image description here

In that example the footer view (Disclaimer View) has two labels ( Llb Disclaimer Title and Lbl Disclaimer Content).