我有一个由 1 个标题和 1 行按顺序组成的表格:
Header
Row
Header
Row
我已设置 contentInset
来降低表格内容的起始位置:
self.detailTableView.contentInset = UIEdgeInsetsMake(30.0, 0.0, 0.0, 0.0);
它工作得很好,但是,当滚动表格时,表格行的内容在第一个标题上方可见。它们不会消失,而是在顶部边缘 30 像素内可见。如何隐藏它们呢?以便滚动正常工作。
最佳答案
我假设您在表格 View 中有粘性标题。
如果您想在顶部添加填充,您只需设置表头 View 即可:
tableView.tableHeaderView = UIView(frame:CGRect(x: 0, y: 0, width: view.frame.width, height: 30))
关于ios - UITableView contentInset : when scrolling the table to the top, 行在第一个标题上方仍然可见,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38480444/