Empty space below navigation bar with displaysSearchBarInNavigationBar = YES

烈酒焚心 提交于 2019-12-05 16:18:53

For me the key was to set the option to enable "Under Opaque Bars" in the StoryBoard editor.

The only solution I have found thus far for this, is to use

self.tableView.contentInset = UIEdgeInsetsMake(-44, 0, 0, 0);

in the viewDidLoad. This sets a negative offset for 44 (known height of searchbar) to clear that extra space.

A bit of a hack but it works.

Олег Чебулаев

I have got the same problem. It happens, when you initialize UISearchDisplayController in viewDidLoad. Replace this part of code to loadView. This should fix this problem!

u10int

I has the same issue and after no solutions others offered actually fixed it for me, I was able to figure out a workaround for this iOS 7 bug: https://stackoverflow.com/a/21493296/580560

I fixed the empty space using both solution from @Jeremy Hicks and @dsgrant07. Thanks guys.

So put this in the wiewDidLoad:

- (void)viedDidLoad{
   [super viedDidLoad];
   ...
   self.tableView.contentInset = UIEdgeInsetsMake(-44, 0, 0, 0);
}

and configure your storyboard:

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!