When I switch navigationBar to translucent, my UISearchDisplayController went crazy.
The dimmed area is missplaced by 64px, same for first row in results table. I know how to fix resultTableView missplacement, but I cannot find a way to fix dimmed area frame.
Strangely enough I found that my main view is in origin.y = 64.0f when translucent is set to YES. It happens somewhere in between viewDidLoad, viewDidAppear. If I change it it works, but than transitions between views in navigations controller are broken.
=============
Problem solved by: extendedLayoutIncludesOpaqueBars
Check the search bar's AutoLayout/AutoResizingMask settings.
Also make sure you're not manually modifying the bar's frame as the system will try to animate the bar into its position along the dimmed view and results' table view.
When you set the translucent
property and automaticallyAdjustsScrollViewInsets
to YES
(default): a) the view gets stretched under the navigation bar and b) a top contentInset
is added to the underlying UIScrollView
(table view is a subclass).
My guess is that only b) is happening in your case for some reason. You can try to solve it by either:
automaticallyAdjustsScrollViewInsets
.contentInset
from your scroll view.extendedLayoutIncludesOpaqueBars
.