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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to