문제

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

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top