My goal is the following: have a UISearchBar which is always visible. When it isn't active, there is some content on the bottom part of the controller. When it becomes active, I want to display the results of the search in a UITableView that overlaps the UIController.
The way my search is setup is the following: I have a fixed UIView on the top of my ViewController, created via Storyboard. In my viewDidLoad method, I add the searchController.searchBar to that UIView, so that the UISearchBar is permanently active. I use the very useful following line to hide/display the searchResultsController: searchController.searchResultsController.view.hidden = FALSE;
All of this works perfectly, except that when I display results, if I scroll down, the results are displayed on top of the UISearchBar. 
What is the way to avoid this? I believe this is due to the fact that I use the following line:
[searchBarView addSubview:self.searchController.searchBar];
where searchBarView is an empty placeholder view which I create on my Storyboard and stick to the top. This is the only way I found that have the searchBar displayed permanently. It's important to note that I don't use a navigation controller and that's why I don't add the searchController as a navigation item.
Thanks a lot for your help!
from Objective-C - UISearchController results overlap on UISearchBar when scrolling
No comments:
Post a Comment