Reputation: 1501
I have a table view that has a number of sections with varying numbers of rows which have been created dynamically.
I would like to add footer text to certain sections of my UITableView. I know this is easily done when implementing static UITableViews (see image), but I am having difficulty programmatically adding footer text in Swift.
I am aware of how to add titles to each section.
Upvotes: 0
Views: 2812
Reputation: 106
func tableView(_ tableView: UITableView, titleForFooterInSection section: Int) -> String?
Upvotes: 1
Reputation: 167
See the UITableViewDelegate documentation under "Modifying Header and Footer of sections"
tableView:viewForFooterInSection:
Asks the delegate for a view object for a view object to display in the footer of the specified section.
Upvotes: 0
Reputation: 1263
You need to implement UITableViewDelegate protocol method:
tableView(tableView: UITableView, viewForFooterInSection section: Int)
*Just don't forget to set the delegate first.
Upvotes: 0