Programmatically add a UISearchBar
Programmatically add a UISearchBar
- Subject: Programmatically add a UISearchBar
- From: Nala Gnirut <email@hidden>
- Date: Fri, 30 Oct 2009 11:12:44 +0100
Hi all,
I'm trying to programmatically add UISearchBar to my UITableView header:
- (void)viewWillAppear:(BOOL)animated {
[...]
if (!self.tableView.tableHeaderView) {
// Add the search bar
searchBar = [[UISearchBar alloc] init];
self.tableView.tableHeaderView = searchBar;
searchController = [[UISearchDisplayController alloc]
initWithSearchBar:searchBar
contentsController:self];
[searchController setActive:YES animated:NO];
[searchController setActive:NO animated:NO];
[...]
}
// Hide the searchbar
[self.tableView setContentOffset:CGPointMake(0,44)];
[...]
}
Unless I activate/deactivate the searchController:
[searchController setActive:YES animated:NO];
[searchController setActive:NO animated:NO];
the searchBar is not correctly shown on table header.
Is there a more elegant / correct way to avoid this glitch?
Thanks in advance.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden