I have a popover with a UITableViewController as the content view controller. The table view has a UISearchBar as its header view.
Now, on iOS 6 everything looks good when the UISearchDisplayController becomes active. But, on iOS 7 there will be an extra space above the search bar.

So how can I get rid of this extra space above the search bar on iOS 7?
The solution is to set the property edgesForExtendedLayout of the UITableViewController to UIRectEdgeNone.
- (void)viewDidLoad {
[super viewDidLoad];
if ([self respondsToSelector:@selector(edgesForExtendedLayout)]) { /// iOS 7 or above
self.edgesForExtendedLayout = UIRectEdgeNone;
}
}
This property has the value UIRectEdgeAll by default. Which means all edges of the view will be extended to keep an extra space for the status bar (the height of the space above the search bar is exactly 20px, the same height of the status bar).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With