简体   繁体   English

tableView标头部分的快速怪异的tableview滚动行为

[英]swift weird tableview scroll behaviour from tableView header section

I have a weird tableview header behaviour when scrolling. 滚动时,我有一个怪异的tableview标头行为。

When I scroll up the header sticks on top of the view and a cell scrolls under the header. 当我向上滚动时,标题栏位于视图顶部,并且单元格滚动至标题下方。

If I scroll up more then the header starts scroll with the tableview. 如果我向上滚动更多,则标题将开始与tableview一起滚动。

Please have a look at GIF I added: 请查看我添加的GIF:

在此处输入图片说明

Set this in viewDidLoad() : viewDidLoad()

automaticallyAdjustsScrollViewInsets = false

And you can set content insets. 您可以设置内容插图。 Like this: 像这样:

tableView.contentInset = UIEdgeInsets(top: <#T##CGFloat#>, left: <#T##CGFloat#>, bottom: <#T##CGFloat#>, right: <#T##CGFloat#>)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM