Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TableView (search results table view) scrolls unexpectedly sometimes

I am working on an app, which has implements a Search Display Controller. The search results table view, doesn't behave right all the time, and I'm trying to solve this issue from a few days. Here is a screen recording of the behavior.

scroll Issue in search results table view

I'm not modifying the frame or bounds of the table view. I'm only resigning first responder when there is no text in the search field, and calling the [searchDisplayController setActive: animated: ] method.

Please help me out.

like image 385
Vignesh PT Avatar asked Dec 11 '22 04:12

Vignesh PT


1 Answers

Instead of setting the scrollIndicatorInsets and contentInsets of the searchResultsTableView when the keyboard hides, putting it within the 'willShowSearchResultsTableView:' delegate method fixed it for me:

- (void)searchDisplayController:(UISearchDisplayController *)controller willShowSearchResultsTableView:(UITableView *)tableView
{
   [tableView setContentInset:UIEdgeInsetsZero];
   [tableView setScrollIndicatorInsets:UIEdgeInsetsZero];
}
like image 166
user2795503 Avatar answered Jan 22 '23 00:01

user2795503