I have a UISearchBar added as a subview to a UICollectionView , and attached to a UISearchDisplayController .
I set it to viewDidLoad :
self.searchController = [[UISearchDisplayController alloc] initWithSearchBar:self.searchBar contentsController:self]; self.searchController.delegate = self; self.searchController.searchResultsDataSource = self; self.searchController.searchResultsDelegate = self; [self.collectionView addSubview:self.searchBar];
When I click another view controller on the navigation controller and then pop it up, the search bar disappears. This only happens if the collection has been scrolled enough to hide the search bar. In addition, even though the search bar disappears, click on an empty space where it is assumed that the search display controller is connected to it.
This only happens on iOS 7, and if I remove the search display controller, the search bar will not disappear.
One more remark. When the search bar has disappeared, if I click another view controller, and then place it, the bar will be visible again.
Apparently this is a UISearchDisplayController bug on iOS 7, so any ideas on how to get around it?
ios ios7 uicollectionview uisearchbar
Hesham abd-elmegid
source share