问题
I have UISearchController
in my app:
searchController = UISearchController(searchResultsController: nil)
searchController.searchResultsUpdater = self
if #available(iOS 9.1, *) {
searchController.obscuresBackgroundDuringPresentation = false
}
searchController.searchBar.frame = searchBarView.frame
searchBarView.addSubview(searchController.searchBar)
searchController.searchBar.delegate = self
The problem is that when I enter the SearchBar
and then click the cancel button the search bar not back to the frame I define here(and stretched to full size screen):
searchController.searchBar.frame = searchBarView.frame
Any idea what can be the problem?
来源:https://stackoverflow.com/questions/57647341/uisearchcontroller-searchbar-changes-after-click-cancel-button