swift 4 UITableView Footer, absolute bottom

footer view uitableview swift
uitableview fixed footer at bottom
add button to uitableviewcell swift 4
add view to bottom of uitableview
add button in footer uitableview swift
uitableview section header swift 4
swift footer cell
uitableview footer height 0

I a have created a footer for my UITableView like so:

let customView = UIView(frame: CGRect(x: 0, y: self.view.bounds.height - 50, width: self.view.bounds.width, height: 50))
            customView.backgroundColor = UIColor.red

            commentText = UITextField(frame: CGRect(x: 0, y: 0, width: self.view.bounds.width - 50, height: 50))
            commentText.backgroundColor = UIColor.white
            commentText.layer.borderColor = UIColor.gray.cgColor
            commentText.layer.borderWidth = 1
            commentText.borderStyle = .roundedRect
            commentText.placeholder = "Enter Comment"

            let submitButton = UIButton(frame: CGRect(x: self.tableView.bounds.width - 50, y: 0, width: 50, height: 50))
            submitButton.setTitle("Go", for: .normal)
            submitButton.backgroundColor = UIColor.blue
            submitButton.addTarget(self, action: #selector(self.submitButtonPressed(_:)), for: .touchUpInside)

            customView.addSubview(commentText)
            customView.addSubview(submitButton)

            tableView.tableFooterView = customView

and here is the result of it in the screenshot:

What I am trying to do is have the footer always at the bottom of the screen, is this possible?


A table view footer is always at the end of the table view, after the last row in the table view. This is true no matter how many rows are in the table view.

If you want a view that stays at the bottom of the screen and never scrolls no matter how many rows there are, then you don't want a table view footer. You simply want a view added to the bottom of the screen.

The best solution is to use a UIViewController that has your "footer view" pinned to the bottom and a table view added that fills the rest of the screen.

How can I make the footerview always stay at the bottom in , The tableview footer view would always stay at the bottom of the If you need to make the footer view fixed at the bottom then you can not use a TableViewController dequeueReusableCell(withIdentifier: "TableCellTest", for: indexPath) cell. Swift Code which make the footerView fill the rest space at the​  22,382 In this swift tutorial, you are going to learn how to build a custom UITableView programmatically using Swift 4.0 with STEP by STEP instructions. Along the way, I am going to be showing you how to create a custom UITableViewCell programmatically from scratch as well. If you are new to building programmatic UI in […]


maybe you can just add the footer view at the bottom of the screen view, not add it as a footer view of UITableView, since you don't want the textfield and submit button to move when UITableView scroll.

How to add a Submit button after the end of the tableview using Swift?, Let's see this with help of an example where we'll add a footer vi . the table, we will add code for adding button at the bottom of the table view. UiTableView how to add fixed footer to bottom If you want to have fixed footer in bottom of view controller which will be not scroll with the table then you can not use UITableViewController . Your view controller must be implemented as UIViewController .


You can just add your custom view to the view itself instead of the tableview.

view.addSubView(customView)

iOS Swift. UiTableView how to add fixed footer to bottom, If you want to have fixed footer in bottom of view controller which will be not scroll with the table then you can not use UITableViewController. Use UITable View Header Footer View objects to manage the header and footer content of your table's sections efficiently. A header-footer view is a reusable view that you can subclass or use as is. To generate a header or footer with a standard appearance, configure the text Label property with the text you want to


Headers and Footers in iOS TableView, Let's see what is like a tableview with footers (and headers). Picture. That tableview above has in total 4 sections, each one with 3 rows. The first thing to notice is that the footer of the last visible section always appears on the bottom of same way, the header always appears fixed on top of the tableview) UITableView manages the basic appearance of the table, but your app provides the cells ( UITableViewCell objects) that display the actual content. The standard cell configurations display a simple combination of text and images, but you can define custom cells that display any content you want. You can also supply header and footer views to


UITableView Footer, Stop from floating over content, I would like to make my UITableView Footer stop floating over my content, as is the cell of its section and does get fixed on the bottom of the tableview you need to add an Also you can check this answer for misplacement of your tableview. Now let’s further tweak the app to make it even cooler. We’ll add header and footer views for each section of recipes. The UICollectionViewFlowLayout, that our app is using, already provides optional header and footer views for each section. Here the header and footer views can be referred as the supplementary views of the flow layout.


tableView(_:viewForFooterInSection:), Asks the delegate for a view object to display in the footer of the specified section of the table view. SDKs. iOS 2.0+; Mac Catalyst 13.0+; tvOS 9.0+ optional func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? The view object to display at the bottom of the specified section. The problem is that UITableView does something to the header/footer view, encapsulating it, and creating a required (priority 1000) constraint on the height. And this height will be slightly taller than your layout (maybe to cater for the separator?). Anyway, the height does not match.