UITableView with header works incorrectly for any view except UISearchBar

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 (ie 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)?

    链接地址: http://www.djcxy.com/p/55968.html

    上一篇: 事件后UISearchBar消失

    下一篇: 带有标题的UITableView对除UISearchBar以外的任何视图都不正确