UITableView with header works incorrectly for any view except UISearchBar

会有一股神秘感。 提交于 2019-12-10 11:47:25

问题


I have standard master-detail navigation based app with first VC as UITableView. I want almost standard UITableView with custom tableHeaderView (UISearchBar enhanced with additional button).

First I have tried to set UISearchBar as header view and everything works just fine.

But when I set a custom view (even simple empty UIView) as tableHeaderView, table begins to behave wrongly:

  • Header view scroll offset is not adjusted automatically (i.e. header not automatically slides up or down)
  • When push to another view controller happens, UITableView scrolls to Zero contentOffset, which is noticeable by user

This is strangle because UISearchBar being set as header should not affect tableView scroll logic. Maybe apple uses some hidden APIs?

Anyway, is there a way to make custom header that works smoothly like with a SeacrBar (without side effects)?

来源:https://stackoverflow.com/questions/22826810/uitableview-with-header-works-incorrectly-for-any-view-except-uisearchbar

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!