iOS reloadSections TableView下移问题

在代理方法中写入Header高度

func tableView(_ tableView: UITableView, estimatedHeightForRowAt indexPath: IndexPath) -> CGFloat {
        return 52
    }

然后刷新时候调用

            CATransaction.begin()
            CATransaction.setCompletionBlock({
                self.tableView.reloadData()
            })
            self.tableView.reloadSections([section], with: UITableView.RowAnimation.automatic)
            CATransaction.commit()

你可能感兴趣的:(iOS reloadSections TableView下移问题)