Pregunta

I am calling the following function to successfully hide my search bar in viewDidLoad:

- (void)hideSearchBar {
    CGRect newBounds = self.tableView.bounds;
    newBounds.origin.y = newBounds.origin.y + _searchBar.bounds.size.height;
    self.tableView.bounds = newBounds;
}

enter image description here

but if I call the exact same function in (void)searchBarTextDidEndEditing:(UISearchBar *)searchBar the top row of my table view becomes overlapped with the navigation bar. Why is this overlap only happening when calling the hide function from searchBarTextDidEndEditing?

enter image description here

¿Fue útil?

Solución

An answer from this question helped me realize this is somehow related to the nav bar being translucent. When I set the nav bar translucent to NO I had the issue. When I stopped making it NO, it works fine.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top