我在搜索controller和搜索栏上有问题。 A具有带有tableView的ViewController。添加searchController:
let customSearchController = UISearchController()
customSearchController.delegate = self
customSearchController.searchBar.delegate = self
customSearchController.searchResultsUpdater = self
definesPresentationContext = true
navigationItem.searchController = customSearchController
工作正常,但是如果向下滚动列表/向上滚动列表,我在“ divion searchbar”上打破了动画(gif上的第一个应用列表list in gif):
“ rel =“ nofollow noreferrer”>
我已经从Apple Developer下载了该项目(),在此项目上,searchbar-andimation是平稳且正常工作(GIF上的第二个应用程序)。我比较了searchController和TableView上的所有设置 - 它们是平等的。
问题在哪里?谢谢
更新:解决问题。使用 uitaiteViewController 而不是 uiviewController + uitaiteView ,这就是全部。动画正确。
I have a problem with searchController and searchBar. A have ViewController with tableView. Adding searchController:
let customSearchController = UISearchController()
customSearchController.delegate = self
customSearchController.searchBar.delegate = self
customSearchController.searchResultsUpdater = self
definesPresentationContext = true
navigationItem.searchController = customSearchController
Works fine, but if scrolling list down/up, I have broken animation on dismiss searchBar (first app with countries-list on gif):

Animation is abrupt, sometimes covers the top cell of the tableView. Sometimes searchBar-dismiss stopped and not ended.
I've downloaded the project from Apple Developer (https://developer.apple.com/documentation/uikit/view_controllers/displaying_searchable_content_by_using_a_search_controller) and on this project searchBar-animation is smooth and works fine (second app on gif). I compared all settings on searchController and tableView - they are equatable.
Where is the problem? Thanks
Update: Problem solved. Use UITableViewController instead UIViewController + UITableView, thats all. Animation works correct.
发布评论