IOS 7 searchdisplaycontroller and table view offset do not match offsets

I have a table view in the RectEdgeAll view controller and a search bar as a table title. When I start the search, the search bar animates and settles to a normal position at the top of the screen, but the table view does not follow it, it remains in the same position before starting the search, leaving a space between both views. How to create an animation with the search bar?

I tried to update the table's contentOffset already when the search started, but it was not even moved.

I tried the table and the search bar in both directions: code and storyboard.

- (void)viewDidLoad
{
    [super viewDidLoad];

    self.tableView.dataSource = self;
    self.tableView.delegate = self;

    //self.searchBar = [[UISearchBar alloc] initWithFrame:CGRectMake(0, 0, 320, 44)];
    self.searchBar.delegate = self;
    self.searchController = [[UISearchDisplayController alloc] initWithSearchBar:self.searchBar contentsController:self];
    self.searchController.delegate = self;


}

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    [self.view addSubview:self.tableView];
    self.tableView.tableHeaderView = self.searchBar;
}

Before searching:

enter image description here

After the search:

enter image description here

+4
1

[self.view addSubview:self.tableView]; self.tableView.tableHeaderView = self.searchBar;

viewDidLoad.

 [self.tableView setFrame:CGRectMake(0, 0, 320, 400)];

viewdidappear, , tableview , viewdidload, . ,

0

All Articles