UISearchBar presented by UISearchController in table header view animates too far when active
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am using UISearchController to present a search bar inside the header view of a tableview: ... self . searchController . hidesNavigationBarDuringPresentation = NO ; self . presentingTVC . tableView . tableHeaderView = self . searchController . searchBar ; [ self . searchController . searchBar sizeToFit ]; self . presentingTVC . tableView . tableHeaderView = self . searchController . searchBar ; (where setting the tableHeaderView property twice is necessary as otherwise the header view overlaps the first row, c.f. a couple of answers on S.O