I\'m trying to add a custom header to UITableView
, that has some buttons and an UISearchBar
.
The problem is, that when I try to use searchBar I ge
Just follow the simple steps here..
Use the following delegate method to set it as the header of your table view...
– (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
return self.mySearchBar;
}
Are you adding to the table via:
[self.tableView addSubview:customView]
If so, that could be your error. Adding subviews to UITableView requires that you add them either as header, footer, or cell explicitly. Try:
self.tableView.tableHeaderView = customView