更新以后引起的collectionview headerview 错位问题,看下效果

严重错位,但是他会随着一起滚动,只是位置错误,看文档发现弃用了automaticallyAdjustsScrollViewInsets属性,新增contentInsetAdjustmentBehavior 这个枚举里面有4个属性,我使用UIScrollViewContentInsetAdjustmentNever
设置完成以后,发现起始位置还是部正取,感觉是safe arear引起的,于是手动设置内边距
这个安全区域的头和底 分别是 44 和34 在根据系统版本 和手机型号分别设置,最终还原以前的效果

代码如下

网友评论