Simply just add a footer to your tableView and it will be placed at the bottom, no matter how many sections you have
let tableViewFooter = UIView(frame: CGRect(x: 0, y: 0, width: tableView.frame.width, height: 50))
tableViewFooter.backgroundColor = UIColor.greenColor()
let version = UILabel(frame: CGRectMake(8, 15, tableView.frame.width, 30))
version.font = version.font.fontWithSize(14)
version.text = "Version 1.x"
version.textColor = UIColor.lightGrayColor()
version.textAlignment = .Center;
tableViewFooter.addSubview(version)
tableView.tableFooterView = tableViewFooter
If you want to add a footer for each section
Create a UIView()
in your tableView(tableView: UITableView, viewForHeaderInSection section: Int) -> UIView
? method and add a label to that view and center the label within it.
Example:
func tableView(tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
let view = UIView()
let version = UILabel(frame: CGRectMake(8, 15, tableView.frame.width, 30))
version.font = version.font.fontWithSize(14)
version.text = "Version 1.x"
version.textColor = UIColor.lightGrayColor()
version.textAlignment = .Center;
view.addSubview(version)
return view
}