2

When the searchbar becomes active it jumps. See animated GIF.

Result: http://postimg.org/image/66bdqqgvb/

Searching for a solution on Stackoverflow I found the following setting:

    self.edgesForExtendedLayout = UIRectEdgeNone;

Result: http://postimg.org/image/y5gf4bb9b/

The jump is gone but now the searchbar does not cover the statusbar anymore.

Update

Making the background color of the window the same color as the searchfield makes it look fine though it is kind of a hack.

2 Answers2

1

You should have

self.edgesForExtendedLayout = UIRectEdgeAll;

instead, but that would just bring you back to your first state. So I would look around on other actions that may be causing this, refer any additional information of what you are performing when initiating/dismissing a search. Are you performing additional background operations or animations in your main thread ?

EDIT

Here goes another suggestion, rarely on the animation looks like the search bar moves separated from your table view. So please double check that your search bar is inside your table view.

CoderPug
  • 908
  • 9
  • 19
  • The searchbar is inside the tableHeaderView and no other code is performed when the searchbar becomes active. – Jonas Treub Jan 09 '14 at 15:07
  • When you look at the first GIF and wait till the searchbar animates to an inactive state you can see the searchContentsController does not cover the whole area at the bottom. About 20px (same as statusbarheight) is not covered. Might this be the cause? – Jonas Treub Jan 09 '14 at 15:09
0

This seems to be a bug in iOS 7. Setting edgesForExtendedLayout = UIRectEdgeNone; does fix it, but then you have a bar above your search bar. The best solution I've found is to make your navigation bar translucent. For some reason, the animation is only broken when the navigation bar is opaque.

self.navigationController.navigationBar.translucent = YES;
Ben Gotow
  • 14,805
  • 3
  • 42
  • 47