Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why do I get a gap between my UISearchBar and my UITableView Cell Header when I touch the UISearchBar on iOS7?

These two pictures should explain it. The first shows my UITableView normally. The second shows when I touch the UISearchBar and it takes focus. Why is there a gap between the cell header and the search bar? Anyone know how to fix this?

iOS 7 is when this occurs by the way. I already have this code:

- (CGFloat) tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    if (tableView == self.searchDisplayController.searchResultsTableView)
    {
        return 0;
    }
    else
    {
        return 23;
    }
}

enter image description here

enter image description here

like image 780
Ethan Allen Avatar asked Dec 05 '25 04:12

Ethan Allen


1 Answers

I fixed this problem in my code by removing the following 2 lines of code.

self.viewController.edgesForExtendedLayout = UIRectEdgeNone; self.navigationBar.translucent = NO;

Hope that leads you in the right direction.

like image 200
cnotethegr8 Avatar answered Dec 07 '25 20:12

cnotethegr8



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!