如何摆脱出现在表视图顶部和之间的空 UITableCell

How to get rid of an empty UITableCell appearing top and in between tableview

I used below lines of code to get rid of the empty UITableview cells 但运气不好。感谢任何帮助。

tableView.tableFooterView = UIView()
tableView.tableHeaderView = UIView()

你应该使用 nil 而不是 UIView()

tableView.tableHeaderView = nil