如何删除 UITableViewCell 第一行的垂直间距

How to remove vertical spacing of first row of UITableViewCell

我有一个 ViewController 和 TableView。

当我尝试配置我的单元时,我在顶部和原型开始之间得到这个 space(从最顶部到单词 "prototype cell")

在运行模式下看起来很糟糕

当我尝试以任何方式将 PrototypeCellsCount 选择为 1 时,它就会出现。请帮我删除它。

这就像一种错误,有时会发生,有时不会,请尝试按以下方式调整 viewDidLoad() 中的 contentInset

// The value depends of some factors, you need to play around it
self.tableView.contentInset = UIEdgeInsetsMake(-65, 0, 0, 0)

希望对你有所帮助。

尝试在生成器中检查 "Adjust Scroll View Insets"。这通常是解决此类间距问题的方法。