Search bar, hiding navigation bar when activated

I came across a strange scenario, I used the search bar in my application and associated it with a table view, as shown in the figure below.

enter image description here

But when I try to find something, the search bar slides and hides in the navigation bar, I used the search bar several times and never saw me look like the one shown below on the screen.

enter image description here

I can’t remove the navigation bar because I need it, but I just can’t understand why and how this can happen,

It should be noted that the search bar and controller work fine when they try to perform a search, and only it is hidden behind the navigation bar,

Any help on this would be appreciated as I simply cannot understand its cause.

+5
source share
1 answer

Try the following:

Set the translucent navigation bar property to NO:

self.navigationController.navigationBar.translucent = NO; 

This line captures the view from the frame under the navigation bar and the status bar.

If you need to show and hide the navigation bar, use this code in viewDidLoad

  if ([self respondsToSelector:@selector(edgesForExtendedLayout)]) self.edgesForExtendedLayout = UIRectEdgeNone; // iOS 7 specific 
+6
source

Source: https://habr.com/ru/post/1209769/


All Articles