How do I embed the search bar with the navigation bar items?
I used [searchBar sizeToFit] and it didn't work and without using displaysSearchBarInNavigationBar the navigation bar disappears when clicking on the searchBar.
I tried the answer in UISearchDisplayController UISearchDisplayController hiding navigation bar
-(void)viewDidLayoutSubviews{
[self.navigationController setNavigationBarHidden:NO animated:NO];
}
but it causes the UISearchDisplayController searchResultsTableView to be displayed below navigation bar while hiding the search bar.
[tableView setFrame:CGRectMake(0, 42, 320, 380)];but the problem that now it is not compatible with other iOS devices and the cancel button does not work when there are data in search bar. Anyone else has any suggestions? - Olla AshourCGRectMakeCGRect s = self.searchDisplayController.searchBar.frame; CGRect newFrame = CGRectMake(0, s.size.height, s.size.width, s.size.height*[filteredList count]); tableView.frame = newFrame;but the cancel button issue remains and now the live search rows do not update even with[tableview reload]. - Olla Ashour