我有一個UISearchController
,我用編程方式呈現時,用戶觸摸一個按鈕。我的問題是,搜索欄重疊的狀態(見截圖)呈現UISearchController與狀態欄重疊
我有以下的代碼,我用它來呈現UISearchController
func presentSearchController() {
let resultsController = ResultsViewController()
self.searchController = UISearchController(searchResultsController: resultsController)
self.searchController.searchBar.searchBarStyle = .prominent
searchController.hidesNavigationBarDuringPresentation = false
searchController.searchResultsUpdater = resultsController
self.definesPresentationContext = true
self.present(self.searchController, animated: true, completion: nil)
}
編輯:我的問題是不是重複UISearchBar overlaps status bar in iOS,因爲我不直接與搜索欄或它的框架
它看起來就像你有一個從'CGRectMake地方搜索欄架(0 ,0,寬度,hright)'在th vc?對? –
我在半個小時之前遇到了同樣的問題。 –
@Mukesh我已經解決了這個問題。看到我的回答如下 – Lneuner