iphone - Search bar disappears from my root view controller

Posted by Sudharsanan on Stack Overflow See other posts from Stack Overflow or by Sudharsanan
Published on 2010-04-28T22:05:00Z Indexed on 2010/04/28 22:07 UTC
Read the original article Hit count: 190

Hi,

I have a search bar in my main screen - root table view controller. If I browse other screens and come back, sometimes, the search bar disappears. Here's my code.

    searchBar = [[UISearchBar alloc] initWithFrame:CGRectMake(0, 0, self.tableView.frame.size.width, 0)];
    searchBar.delegate = self;
    searchBar.tintColor = [UIColor blackColor]; 
    [searchBar sizeToFit];
     self.tableView.tableHeaderView = searchBar;

    searchDisplayController = [[UISearchDisplayController alloc]
                                  initWithSearchBar:searchBar contentsController:self];
    searchDisplayController.delegate = self;
    searchDisplayController.searchResultsDataSource = self;
    searchDisplayController.searchResultsDelegate = self;

Is there anything wrong with my code or is it one of the quirks of SDK 3.0?

© Stack Overflow or respective owner

Related posts about iphone

Related posts about search