How to add a footer to a UITableView in Storyboard

我们两清 提交于 2019-12-17 15:34:57

问题


I'm fairly new to iOS development.

I want to add a footer to the table view in a UITableViewController. I've made the view I want to use as the footer graphically in Storyboard, however I can't work out how to hook it up as the footer to my table view.

I can add a footer programmatically in UITableViewController's viewDidLoad method by assigning self.tableView.tableFooterView. But I've created my footer view in Storyboard, what is the best practice way of adding it as the footer to my table view?


回答1:


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.




回答2:


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

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




回答3:


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.



来源:https://stackoverflow.com/questions/9605381/how-to-add-a-footer-to-a-uitableview-in-storyboard

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!