UISearchBar presented by UISearchController in table header view animates too far when active

后端 未结 15 1022
长情又很酷
长情又很酷 2020-11-29 01:28

I am using UISearchController to present a search bar inside the header view of a tableview:

...
self.searchController.hidesNavigationBarDuringPresentation =         


        
15条回答
  •  -上瘾入骨i
    2020-11-29 02:12

    In my case, setting the nav bar to self.navigationController.navigationBar.translucent = NO; fixed the problem. It seems that the search bar presentation layer doesn't take into account the translucence of the nav bar when laying out the search bar.

    I realize this isn't a perfect solution, because the translucence of the nav bar can throw off layout elsewhere, but it at least fixes the problem in the case where a non-translucent nav bar is a possibility.

提交回复
热议问题