Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Search bar getting hidden by navigation bar when becomes active

I am facing a weird scenario, I have used a search bar in my application and tied it up with a table view as is seen in the below image!

enter image description here

But when ever I try to search anything the search bar slides up and gets hidden by navigation bar, I have used search bar a number of times and never seen me thing like this below is its screen shot !

enter image description here

I can't remove the navigation bar since I need it, but I just can't figure out why or how it can be happening,

One point to note is that the search bar and it's controller are working perfectly when tried to search, only thing is it's getting hidden behind the navigation bar,

Any help on this would be appreciated, as I just can't figure out its reason.

like image 566
Geet Avatar asked Dec 23 '14 12:12

Geet


1 Answers

Try this:

Set the navigation bar's translucent property to NO:

self.navigationController.navigationBar.translucent = NO;

This line will fix the view from being framed underneath the navigation bar and status bar.

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

 if ([self respondsToSelector:@selector(edgesForExtendedLayout)])
    self.edgesForExtendedLayout = UIRectEdgeNone;   // iOS 7 specific
like image 157
Mrunal Avatar answered Oct 03 '22 07:10

Mrunal