Create a new display controller XXSearchDisplayController
derived from TTSearchDisplayController
, in the XXSearchDisplayController.m
- (BOOL)searchDisplayController:(UISearchDisplayController *)controller
shouldReloadTableForSearchString:(NSString *)searchString {
return NO;
}
This will disable the auto searching. After this, go to your class derived from TTTableViewController
, say XXProductsTableViewController
@implementation XXProductsTableViewController
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
UISearchBar* searchBar = [[UISearchBar alloc] init];
searchBar.delegate = self;
_searchController = [[XXSearchDisplayController alloc] initWithSearchBar:searchBar contentsController:self];
}
return self;
}
#pragama mark - UISearchBarDelegate
- (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar {
[self.searchViewController.dataSource search:searchBar.text];
}
@end
The above code will do the searching once the user clicks on the "Search" button