ios - What is this strange white space at the top of my UIViewController when using the Search Controller on my device?
问题描述
Left side displays my app in the iPhone 7 simulator. Right side is the app as displayed in my device. When tapping in the search bar, the navbar sildes up but then slides back down as showing in the image with the "What is this?" text.
The code for my search controller is as follows and it is being called in viewDidLoad.
//MARK: - Search Controller
func configureSearchController() {
searchController.dimsBackgroundDuringPresentation = false
definesPresentationContext = true
// to receive updates
searchController.searchResultsUpdater = self
// Set up searchbar of search controller
searchController.searchBar.scopeButtonTitles = ["All", "Something", "Something"]
searchController.searchBar.delegate = self
// add the searchbar to the tableview
tableView.tableHeaderView = searchController.searchBar
// hack to fix ocassional bugs
searchController.searchBar.sizeToFit()
}
解决方案
推荐阅读
- python - 不同的嵌入文档
- ruby-on-rails - 为什么我的路线给了我错误的方向
- reactjs - react-admin:如何在 Datagrid 的每一行上显示删除按钮
- python - TypeError:“NoneType”对象不可调用-Beautifulsoup 4
- c - 从内核空间声明一个指向用户空间数组的指针并填充它
- python - 如何在具有 32 位和 64 位版本的同时在虚拟环境(.virtualenvs)中安装 64 位软件包?
- java - 分隔测试文件夹的约定
- python - 如何在 Python 中使用 importlib 使用 from x import y
- vba - 我想创建一个新产品,然后在两个小时后将另一个文档中的一些部件添加到新的 ProductDoc 中,这似乎是不可能的
- javascript - 如何在axios中使用电子打印功能