Creating a UIView that sticks to bottom of UITableView

前端 未结 7 777
一个人的身影
一个人的身影 2021-01-05 06:47

I have a grouped UITableView and I\'d like to add a UIButton to the very bottom of my UITableView. I\'m using Storyboard and a UITableViewControlle

7条回答
  •  猫巷女王i
    2021-01-05 07:19

    I'd like to provide another solution to the existing ones. You can use a normal ViewController for your main view where you want to have the sticky view in it. Then, add a container view to the ViewController to display the table and add another view which should become the sticky view.

    It is now possible to point the container view to your TableViewController and add constraints to the sticky view to make it stay below the table.

    As a result the table won't overlap with the sticky view and the sticky view always stays on the bottom of the screen. Furthermore, this concept does not required any changes in your existing TableViewController.

提交回复
热议问题