@property(nonatomic, strong) UISearchDisplayController *strongSearchDisplayController; @property(nonatomic, strong, readwrite) UISearchBar *searchBar;
-(void)InitTableView { // Uncomment the following line to preserve selection between presentations. self.delegate = [[DataTableDelegate alloc]init]; self.delegate.delegate = self; self.delegate.parentTableView = self.tableView; self.tableView.dataSource = self.delegate; self.tableView.delegate = self.delegate; self.searchBar = [[UISearchBar alloc] initWithFrame:CGRectZero]; self.searchBar.placeholder = @"Search"; self.searchBar.delegate = self.delegate; [self.searchBar sizeToFit]; self.strongSearchDisplayController = [[UISearchDisplayController alloc] initWithSearchBar:self.searchBar contentsController:self]; self.searchDisplayController.searchResultsDataSource = self.delegate; self.searchDisplayController.searchResultsDelegate = self.delegate; self.searchDisplayController.delegate = self.delegate; self.tableView.tableHeaderView = self.searchBar; }