BLC*_*BLC 24
contentInsetAdjustmentBehavior在代码中设置新属性,它将解决问题.
if #available(iOS 11.0, *) {
collectionView.contentInsetAdjustmentBehavior = .never
}
Run Code Online (Sandbox Code Playgroud)
UIScrollView上有一个名为contentInsetAdjustmentBehavioriOS 11中添加的新属性,用于确定调整内容偏移量
此属性指定如何使用安全区域insets来修改滚动视图的内容区域.此属性的默认值是自动的.
小智 6
我不知道为什么,但是当我以编程方式添加表视图时,会出现空间.您只需要在viewForHeaderInSection中返回空视图
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
return UIView()
}
Run Code Online (Sandbox Code Playgroud)
如果你想要零空间,也可以添加它,
func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
return 0.01
}
Run Code Online (Sandbox Code Playgroud)
此外,我意识到bug只出现在Swift4中.
| 归档时间: |
|
| 查看次数: |
6203 次 |
| 最近记录: |