我的应用中有UISearchController
:
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
问题在于,当我输入SearchBar
并单击“取消”按钮时,搜索栏不会回到我在此处定义的框架(并拉伸到全尺寸屏幕):
searchController.searchBar.frame = searchBarView.frame
有什么问题吗?