UISearchBar
in a UIViewController
with a UINavigationController
self.navigationController.navigationBar.barTintColor = [UIColor clearColor];
Before tap:
After tapping the search bar:
The problem happens with any color, but using [UIColor clearColor]
as in the photos attached makes it easier to see the issue.
Any solutions will be great, although I prefer something more elegant than hiding the navigation bar title and buttons each time.
This bug happens only when using the following code in viewdidLoad
:
if ([self respondsToSelector:@selector(edgesForExtendedLayout)])
self.edgesForExtendedLayout = UIRectEdgeNone;
I think I got once the same issue. If you are using storyboards, check please that all the outlets are set:
That fixed the animation...
A workaround I used eventually:
- (BOOL)prefersStatusBarHidden
{
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
return self.searchDisplayController.isActive;
return NO;
}
This way when user searches it hides the status bar.
有完全相同的问题,修复结果是一行:
self.searchDisplayController.searchBar.translucent = NO;
I had the same problem. The following code worked:
self.edgesForExtendedLayout = UIRectEdgeTop;
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.