Remove empty rows at the end of UITableView

Removing Empty Rows from the end of UITableView

Sometimes you have a table view with very few number of rows that are not covering the whole screen height.

In that case Xcode will add extra empty rows to your table view which looks very unprofessional.

UITableView with extra empty rows

You can solve this issue adding one line of code to your viewDidLoad() function – replace myTableView with your table name.

myTableView.tableFooterView = UIView()

UITableView

And you are done

Leave a Reply

Your email address will not be published. Required fields are marked *