How do I use the UISearchBar and UISearchDisplayController

First add the UISearchDisplayController to your table view Then set its delegate. Implement the following methods. Demo Project In your .h File @interface ViewController : UIViewController <UITableViewDelegate, UITableViewDataSource> { NSMutableArray *contentList; NSMutableArray *filteredContentList; BOOL isSearching; } @property (strong, nonatomic) IBOutlet UITableView *tblContentList; @property (strong, nonatomic) IBOutlet UISearchBar *searchBar; @property (strong, nonatomic) IBOutlet UISearchDisplayController *searchBarController; In … Read more

searchDisplayController deprecated in iOS 8

The UISearchController class replaces the UISearchDisplayController class for managing the display of search-related interfaces. Source : https://developer.apple.com/library/ios/releasenotes/General/WhatsNewIniOS/Articles/iOS8.html So, as rmaddy said, if you want to get rid of the deprecated warnings, stop using the deprecated classes. Use UISearchController instead: https://developer.apple.com/library/ios/documentation/UIKit/Reference/UISearchController/index.html#//apple_ref/occ/cl/UISearchController

Displaying search bar in navigation bar in iOS 8

According to Apple : UISearchDisplayController is deprecated in iOS 8. (Note that UISearchDisplayDelegate is also deprecated.) To manage the presentation of a search bar and display search results in iOS 8 and later, instead use UISearchController. The UISearchController class defines an interface that manages the presentation of a search bar in concert with the search … Read more

Prevent a UISearchDisplayController from hiding the navigation bar

I just debugged a bit into UISearchDisplayController and found that it’s calling a private method on UINavigationController to hide the navigation bar. This happens in -setActive:animated:. If you subclass UISearchDisplayController and overwrite this method with the following code you can prevent the navigationBar from being hidden by faking it to be already hidden. – (void)setActive:(BOOL)visible … Read more

How to filter NSFetchedResultsController (CoreData) with UISearchDisplayController/UISearchBar

I actually just implemented this on one of my projects (your question and the other wrong answer hinted at what to do). I tried Sergio’s answer but had exception issues when actually running on a device. Yes you create two fetch results controllers: one for the normal display and another one for the UISearchBar’s table … Read more