What it did in RootviewController of UISplitViewController –
UISearchBar *searchBar = [[UISearchBar alloc] initWithFrame:CGRectMake(0, 0, self.tableView.frame.size.width, 0)];
[searchBar setPlaceholder:@"Search within application"];
searchBar.delegate = self;
[searchBar sizeToFit];
searchBar.tintColor=[[UIColor alloc] initWithRed:212.00/255 green:236.00/255 blue:256.00/255 alpha:1.0 ];
self.tableView.tableHeaderView = searchBar;
[searchBar release];
It’s working fine but when we scroll tableview searchbar is also moving with tableview rows.
I want to implement searchbar which will always visible to the user.
I can try with SearchDisplayController but in UISplitViewController we are not getting .xib file for RootViewController.
Please help me out on this.
You can add your search bar to the navigation controller’s navigation bar. Here are the steps:
frame.origin.height.viewtoUIView(assuming it is now a table view) and add a new subviewUITableView, adjusting the frame according to your search bar height.delegate,datasource,tableViewoutlet).This worked for me.