Broken searchBar animation in searchController after scrolling tableView

98 Views Asked by At

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):

enter image description here

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.

0

There are 0 best solutions below