我有一个UISearchController,其searchBar设置为tableView的tableHeaderView:
tableView.tableHeaderView = searchController.searchBar
在运行iOS9的设备上,它运行良好:
但是,当我在运行iOS8的设备上运行它时,没有搜索栏。
根据我的阅读,UISearchController可用于iOS8和更高版本。所以我不明白为什么它的searchBar不能显示在我的iOS8设备上。
最佳答案
UISearchBar不会自动设置其大小,请添加以下代码:
[searchController.searchBar sizeToFit];
Apple Sample
关于ios - UISearchController未在iOS8上显示,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/36491426/