How to remove extra empty cells in TableViewController, iOS - Swift

Stephen Fox picture Stephen Fox · Feb 25, 2015 · Viewed 60.5k times · Source

Hi I have a TableViewController with two static cells, however when displayed, it shows the two static cells, and then all the other empty cells for the tableview. However I don't want to display those cells as they are useless. How do I hide the rest of the cells apart from the two static cell?

Answer

HorseT picture HorseT · Feb 25, 2015

in your viewDidLoad() function add this line of code:

tableView.tableFooterView = UIView()