I have UITableViewController where i was adding UISearchController searchbar as an headerView and I have changed this to navigationItem.searchcontroller for iOS 11 in iOS 11 searchbar won't appear at all even navigationItem was present.
이 검색 창을 사용하지 않으면 UI가 작동합니다. 제가 여기서 뭘 잘못하고 있는지 제안 해주세요. 언급 한 바와 같이 내가 탐색 항목에 추가하려고하면보기 iOS 11의 UISearchBar 정렬 문제
let searchController = UISearchController(searchResultsController: vc)
searchController.searchBar.scopeButtonTitles = ["All", "images", "videos", "others"]
searchController.dimsBackgroundDuringPresentation = false
// Don't remove these two lines then search bar alignment issue will raise
self.extendedLayoutIncludesOpaqueBars = true
self.searchController.searchBar.isHidden = false
definesPresentationContext = false
if #available(iOS 11.0, *) {
self.navigationItem.searchController = searchController // not working for me.
searchController?.hidesNavigationBarDuringPresentation = false
navigationItem.hidesSearchBarWhenScrolling = false
} else {
searchController?.hidesNavigationBarDuringPresentation = true
searchController?.searchBar.sizeToFit()
tableView.tableHeaderView = searchController.searchBar
}
목록은
UI와 아이폰 OS (11)에- 첨부 이미지로 잘못 코드에 나타나지 않습니다
- 검색이 활성화되어있을 때 다른 검색 결과 컨트롤러를 사용하고 있기 때문에 prese에서 작업을 비활성화해야합니다. NT 컨트롤러 - 어떻게하면 쉽게 얻을 수 있습니다.