searchBar = [[UISearchBar alloc] initWithFrame:CGRectMake(0.0, 0.0, 290.0, 44.0)];
UIView *customTableHeaderView = [[UIView alloc] initWithFrame:CGRectMake(0.0, 0.0, 320.0, 44.0)];
UINavigationBar *dummyNavigationBar = [[UINavigationBar alloc] initWithFrame:CGRectMake(0.0, 0.0, 320.0, 44.0)];
[customTableHeaderView addSubview:dummyNavigationBar];
[customTableHeaderView addSubview:searchBar];
[dummyNavigationBar release];
self.tableView.tableHeaderView = customTableHeaderView;
[customTableHeaderView release];
思路:headerview-->view-->navigationbar-->searchbar