如何隐藏表头,并在插入/删除后保持隐藏
我发现,UITableView 修改 contentSize
属性,我无法自己设置它。
这是我的调用堆栈。在此调用之后,contentSize
被修改。我不想要它,因为我想隐藏标题,所以我需要向下滚动视图一点,并使其设置为比可见稍高的 contentSize
以便能够滚动下降一点。
有什么想法如何隐藏表头并在插入/删除后保持隐藏吗?我所说的隐藏是指表格标题最初是“隐藏”的,但当您滚动到顶部时会显示出来。
我正在使用 NSFetchedResultsController
通过 CoreData 获取数据。
I found out, that UITableView modify contentSize
property and I can't set it by myself.
This is my call stack. After this call contentSize
is modified. I don't want it, because of that I want to hide header, so I need to scroll view a little bit down, and to make it I set contentSize
little higher than visible to be able to scroll down a bit.
Any ideas how to hide table header, and keep it hidden after insertion/deletion ? By hide I mean table header initially "hidden" but show up when you scroll to the top.
I'm using NSFetchedResultsController
to fetch data with CoreData.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以实现表视图委托方法来确定标题的大小并返回 0。它会像这样:
这会将每个部分的标题设置为零。您还可以使用
heightForFooterInSection:
以相同的方式编辑页脚大小You can implement the tableview delegate methods for the size of header and return 0. it would like this:
This would set the header for each section to be zero. You can also edit the footer size in the same fashion with
heightForFooterInSection:
看起来 contentSize 在调用controllerDidChangeContent后就被iOS私有代码修改了。
只是为了记录。这是我的解决方案(searchView 是我想隐藏的视图):
Looks like contentSize is modified by iOS private code just after controllerDidChangeContent is called.
Just for record. This is my solution (searchView is view that I want to hide):