Giorgio
Giorgio

Reputation: 13539

Search Display Controller does not show searchBar

I created a simple TableViewController using the template offered by xCode. Then I open the xib file of the TableViewController with Interface Builder and I drag/add a uisearchdisplaycontroller on the top part of the tableView. xCode automatically creates and link all the outlets. I save the xib file and I run the app but the searchBar is not displayed!

What else should I do to make appear the searchBar?!?

THANK YOU VERY MUCH!!!

Upvotes: 1

Views: 603

Answers (1)

sasquatch
sasquatch

Reputation: 285

I was having this exact issue. I would drag the search bar, it would "snap" into place on the table as a header, but it would never show.

I found that when you are presenting the next View you need to initWithNibName:

Example:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    UITableViewSubclass *dvc = [[UITableViewSubclass alloc] initWithNibName:@"UITableViewSubclass" bundle:nil];
    [self.navigationController pushViewController:dvc animated:YES];
    [dvc release];
}

This is also assuming you dragged the SearchDisplayController into the xib file. It will do all the necessary connections for you.

Hope that helps.

Upvotes: 3

Related Questions