0

Added a uisearch bar and uisearchbardisplaycontoller programatically (NO XIB) and the search bar sorta displays in the table header but is non functional.

if setActive:YES, setActive:NO on the display controller it appears just fine and is functional

Any ideas why this might be happening?

THanks in advance

searchBar = [[UISearchBar alloc] init];
[self setSearchBarDisplayController:[[UISearchDisplayController alloc] initWithSearchBar:searchBar contentsController:self]];
[[self searchBarDisplayController] setDelegate:self];
[[self searchBarDisplayController] setSearchResultsDataSource:self];

summaryTableView = [[[UITableView alloc] initWithFrame:CGRectMake(0.0, 0.0, 320.0, 416.0) style:UITableViewStylePlain] autorelease]; 
[summaryTableView setDataSource:self];
[summaryTableView setDelegate:self];
[summaryTableView setBackgroundColor:[UIColor clearColor]];
[summaryTableView setSeparatorStyle:UITableViewCellSeparatorStyleSingleLine];
[summaryTableView setRowHeight:[PayCell height]];

[summaryTableView setTableHeaderView:searchBar];

[self.view addSubview:summaryTableView];

[searchBarDisplayController setActive:YES];
[searchBarDisplayController setActive:NO];
SteveG
  • 71
  • 1
  • 1

1 Answers1

0

Could it be that you haven't set up the searchResultsDelegate for the search display controller?

    self.searchDisplayController.searchResultsDelegate = self;

On the Developer Site reference is made to this. Without seeing more code, it's hard to say, but not setting it could be the root of your problem. Here's an excerpt:

searchResultsDelegate The delegate for the table view in which the search results are displayed.

@property(nonatomic, assign) id searchResultsDelegate Discussion The default is nil.

Chris
  • 1,013
  • 1
  • 15
  • 35
  • Thanks, But setting the searchResultsDelegate didn't do anything. The code is really simple... a view with UITableViewDelegate, UITableViewDataSource, UISearchBarDelegate, UISearchDisplayDelegate that creates a searchBarDisplayController, searchbar and a uitable. all the delegate methods for the table view are implemented and load the table with a single row. search delegates are implemented but empty just return default values. At this point I'm just trying to get the searhbar to appear correctly with having to call setActive:YES setActive:NO on the searchBarDisplayController. – SteveG Apr 24 '11 at 15:40