我对UISearchController组件有疑问。我已经设置了这样的搜索控制器:
let searchResultsController = TSSearchResultsController(nibName: "TSSearchResultsController", bundle: nil)
searchResultsController.delegate = self
let searchController = UISearchController(searchResultsController: searchResultsController)
searchController.delegate = self
// SearchController
searchController.searchResultsUpdater = searchResultsController
searchController.hidesNavigationBarDuringPresentation = false
searchController.dimsBackgroundDuringPresentation = false
// SearchBar
searchController.searchBar.delegate = searchResultsController
searchController.searchBar.placeholder = NSLocalizedString("Search", comment: "")
searchController.searchBar.tintColor = IDAssetManager.getColorWhite()
searchController.searchBar.sizeToFit()
searchController.searchBar.searchBarStyle = .minimal
searchController.searchBar.showsCancelButton = false
self.definesPresentationContext = true
...
当我点击搜索结果时,我将视图推送到导航堆栈,该导航堆栈在我初始化searchController的同一位置定义。当我回来时,searchController视图已被推下几位。每次我从navigationController推送和弹出时都会不断发生这种情况。我试过self.extendedEdgesForLayout = []但没有帮助。