简体   繁体   中英

Issue with animation of searchbar in navigationbar when searchDisplayController becomes active

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.

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.

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;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM