Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Giuly

macrumors 68040
Original poster
Hi,
I used a UIView with a UITableView in it and dragged a UISearchBar into the header in IB. Worked as expected, the UISearchBar scrolls with the UITableView.

Now I switched to UITableViewController. It provides an UITableView in IB as well, and I dragged a UISearchBar into it's header:
bildschirmfoto20101114un.png


However, the UISearchBar never shows up:
bildschirmfoto20101114u.png


Is there some kind of trick associated with the UISearchBar to make it appear?

Kind Regards

Edit:
Why ever, you need to set it up yourself, even if it's already setup in IB:

Code:
- (void)viewDidLoad {
  [super viewDidLoad];
  searchBar = [[UISearchBar alloc] initWithFrame:CGRectMake(0, 0, self.tableView.frame.size.width, 0)];  
  searchBar.delegate = self; 
  [searchBar sizeToFit];  
	
  self.tableView.tableHeaderView = searchBar;  
  [searchBar release];
}

Works just fine then:
bildschirmfoto20101114up.png
 
Last edited:
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.