2
votes

The app is UITabBar-based. Search bar is embedded in navigation controller. Although the value of automaticallyAdjustsScrollViewInsets property is YES, the .bottom contentInset of the results controller`s scroll view does not respect tab bar whatsoever.

Stripped-down version of UICatalog sample with demonstration is here: SearchResultsIncorrectContentInsetsDemo on GitHub

Steps to reproduce:

  1. Focus on the search field and perform some search ('o' for example)
  2. Hide the keyboard by pressing 'Search' button
  3. Try to scroll the results up to the bottom

The bottom of the table view content is hiding under the tab bar.

2
Interesting, I've a slightly different problem. With edgesForExtendedLayout = UIRectEdgeAll the bottom inset is correct when the keyboard is hidden and is too large (= there's white space below the last cell) when the keyboard is displayed.Ortwin Gentz

2 Answers

0
votes

You should turn off "Extend Edges"->"Under Bottom Bars" option in "Search Bar Embedded in Navigation Bar" controller in storyboard

0
votes

I have the same issue.

The problem with "automaticallyAdjustsScrollViewInsets" is that the results controller doesn't know that it's embedded in a UITabBarViewController - you can see that this is true by checking that the search results controller's "tabBarController" property is nil.

To counter this issue, I've added the bottom content inset manually inside the culprit view controller.

This is by no means a ideal solution, but, since I don't see a way of notifying the controller that it's in a UITabBarViewController (shame the "tabBarController" property's read only :)), it will have to do until a future enlightenment on this matter.