[英]Dismissing UISearchController breaks grouped UITableViewController visual
我有一個UITableViewController
,可以按字母順序顯示國家/地區。 我在代碼中添加了UISearchController
:
let searchController = UISearchController(searchResultsController: nil)
searchController.searchBar.placeholder = ""
searchController.searchResultsUpdater = self
searchController.dimsBackgroundDuringPresentation = false
definesPresentationContext = true
tableView.tableHeaderView = searchController.searchBar
問題是,當我關閉搜索欄時,UI視覺會中斷,在搜索欄上方顯示一個奇怪的空間:
有什么想法為什么會發生以及如何解決?
嘗試添加:
searchController.hidesNavigationBarDuringPresentation = false
searchController.searchBar.sizeToFit()
self.definesPresentationContext = true
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.