Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UISearchDisplayController with displaysSearchBarInNavigationBar pushes result view down with navigationBar.translucent = false

I am using a UISearchDisplayController with the new ios 7 feature displaysSearchBarInNavigationBar and opaque navigation bars. The search display controller seems to position it's view incorrectly.

I tried plugging in to delegate methods and repositioning but I can not get the initial position correct, nor when rotating. In addition, this seems like a sloppy solution.

with no text in search bar

with text in search bar

like image 226
Joseph Rodriguez Avatar asked Sep 26 '13 21:09

Joseph Rodriguez


1 Answers

Just enabled "Under Opaque Bars " in the storyboard for your view controller or if you like to code.Then add the below lines.Your good :)

self.edgesForExtendedLayout = UIRectEdgeAll;
self.extendedLayoutIncludesOpaqueBars = YES;
like image 119
SRP-Achiever Avatar answered Sep 28 '22 08:09

SRP-Achiever