How to add a footer to a UITableView in Storyboard
Interview Questions practice on Codemia
Over 8,000 real interview questions from top companies, searchable by company and role.
Introduction
In UITableView, there are two different footer concepts: a footer for each section and one footer view for the whole table. If your goal is a single view at the bottom of the table and you are designing the UI in Storyboard, the usual solution is to build a UIView in Storyboard and assign it to tableFooterView in code.
Know Which Footer You Want
This distinction matters:
- '
tableFooterViewis one view for the whole table' - '
viewForFooterInSectioncreates a footer per section'
If you want a static message, button bar, loading indicator, or summary at the end of the entire table, tableFooterView is the correct API.
Build the Footer View in Storyboard
The common Storyboard pattern is:
- add a plain
UIViewto the scene - design its contents with labels, buttons, or stack views
- connect it as an outlet
- assign it to
tableView.tableFooterView
Example outlets:
Then attach it in viewDidLoad:
That is the key step. The view can be created in Storyboard, but the table still needs the explicit assignment.
Make Auto Layout Work with the Footer
tableFooterView does not automatically resize itself from constraints the way normal subviews do. If your footer is designed with Auto Layout content, you often need to force layout and then update the frame height:
This is the part many developers miss. Without it, a footer that looks fine in Storyboard can appear with the wrong height at runtime.
Section Footer Is a Different API
If the footer should appear once per section instead of once for the entire table, implement the delegate methods instead:
This is not the same feature as tableFooterView, even though both are called footers.
That distinction matters in Storyboard-driven apps because the visual design can look similar while the lifecycle and sizing behavior are completely different.
Common Pitfalls
The biggest mistake is building a footer view in Storyboard and assuming the table will use it automatically. It will not until you assign it to tableFooterView.
Another common issue is expecting Auto Layout to size tableFooterView automatically. In practice, you often need to recalculate the frame height after layout.
It is also easy to confuse table footers with section footers and wire up the wrong API for the UI you actually want.
In data-driven screens, it is also worth remembering that footer content may need to be refreshed when the table's data or layout changes, not just once in viewDidLoad.
Summary
- Use
tableFooterViewfor one footer at the bottom of the entire table. - Build the footer in Storyboard if you want, but assign it in code.
- Recalculate the footer height if Auto Layout content is involved.
- Use section-footer delegate methods only when you need one footer per section.
- Most footer bugs come from mixing up these two footer models or forgetting the runtime assignment step.
Related reading
- How to add a gradient to a Button in Flutter?
- How to add a jar in External Libraries in Android Studio?
- How to add a right button to a UINavigationController?
- How to add a touch event to a UIView?
- how to add an action on UITextField return key?
- How to add an activity indicator in SwiftUI
- How to add annotations to MKMapView asynchronously?
- how to add commas to a number in swift?
.png&w=3840&q=75)
Tackling System Design Interview Problems
A short course that equips you with the skills to approach system design interviews methodically.
Start the free courseTrack what you have practised
A free account saves your progress, solutions and study plan across every problem on Codemia.
Interview Questions practice on Codemia
Over 8,000 real interview questions from top companies, searchable by company and role.