避免|避免 tableView 显示不必要的 cell

【避免|避免 tableView 显示不必要的 cell】避免 tableView 显示不必要的 cell 有多种方法,下面这种则简洁高效。

// MARK: - Outlets @IBOutlet internal var tableView: UITableView! { didSet { tableView.tableFooterView = UIView() } }

set tableView.tableFooterView to a blank UIView. This trick is to prevent the table view from drawing unnecessary empty table view cells, which is does by default after all the other cells are drawn.
设置 tableView.tableFooterView 为空的 UIView ,可以避免 tableView 显示不必要的 cell。

    推荐阅读