You need to add insets to your tableView . Try the following code
let insets = UIEdgeInsets(top: 0, left: 0, bottom: 50, right: 0)
tableView.contentInset = insets
Add datasource and delegate for your tableview and utilize following delegate methods:
- heightForFooterInSection & viewForFooterInSection
// set view for footer
func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
let footerView = UIView(frame: CGRect(x: 0, y: 0, width: tableView.frame.size.width, height: 40)) // assuming 40 height for footer.
footerView.backgroundColor = <Some Color>
return footerView
}
// set height for footer
func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
return 40
}
When you use content inset for add padding it may create some issue, when no data available in tableView.
Try this
Simply and the view in a tableFooterView for the padding in the bottom of tableView.
//Add Padding in the bottom of tableview
let view = UIView(frame: CGRect(x: 0, y: 0, width: tableView.frame.size.width, height: 20))
view.backgroundColor = UIColor.white
tableView.tableFooterView = view