开发者

Search Display Controller does not show searchBar

开发者 https://www.devze.com 2023-01-18 11:08 出处:网络
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 uisearchdisplay

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!!!


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消