I have a project using StoryBoards and UISearchDisplayController
used in the context of a UINavigationController
, that appears in the root viewcont
Here is what I did (granted, it's a workaround and not a fix for Apple's bug):
First, in a base UIViewController
I created a property called searchController
:
@property (nonatomic, retain) IBOutlet UISearchDisplayController* searchController;
I added a UISearchBar
in through interface builder so that I have a placeholder in my UI for it. Then, in my viewDidLoad
I manually setup the controller and wire it up:
UISearchDisplayController* searchController = [[UISearchDisplayController alloc]
initWithSearchBar:self.searchBar contentsController:self];
searchController.searchResultsDataSource = self;
searchController.searchResultsDelegate = self;
searchController.delegate = self;
self.searchController = searchController;
[searchController release];
In my viewDidUnload
I make sure to clear it out:
self.searchController = nil;