범위가 tableViewController
이고 searchBar
이고 두 번째 숫자가 navigationBar
입니다.SearchBar와 NavigationBar 사이의 공백 - Swift
내 searchBar
을 클릭하면 내 범위와 모든 작동을 볼 수 있습니다. 그런 다음 행을 클릭하면 내 DetailPage
으로 이동하고 검색 창은 숨겨지지 않습니다 (이유를 모르겠습니다).
그래서 을 취소 한 다음 내 tableView
으로 돌아갑니다. 내 tableView로 돌아 가면 내 SearchBar
과 내 NavigationBar
사이에 공백이 있습니다.
이 내 코드입니다 :
self.resultSearchController = ({
let controller = UISearchController(searchResultsController: nil)
controller.searchResultsUpdater = self
controller.hidesNavigationBarDuringPresentation = true
controller.dimsBackgroundDuringPresentation = false
controller.searchBar.sizeToFit()
controller.searchBar.scopeButtonTitles = ["Title", "Author", "Location", "Price", "User"]
self.tableView.tableHeaderView = controller.searchBar
return controller
})()
func updateSearchResults(for searchController: UISearchController)
{
let scopes = resultSearchController.searchBar.scopeButtonTitles
let currentScope = scopes![resultSearchController.searchBar.selectedScopeButtonIndex] as String
filterContentForSearchText(searchText: searchController.searchBar.text!, scope: currentScope)
}
ScrollView Insets를 false로 조정하면 컨트롤러 속성 검사기가 ScrollView Insets를 선택 취소합니다. –
시도했지만 결과가 같습니다. – Carlo
'frames'을 로깅하여 엔티티 계정을 식별 했습니까? ? (_header, insets, searchbar_)'viewDidLoad'에서 코드를'viewWill/DidAppear'과 구분 짓는 것은 무엇입니까? – Aerows