Ryasoh
Ryasoh

Reputation: 173

uiviewcontroller with navigation bar does not display searchBar in navigation bar

I have a UIViewController with NavigationBar. I'm trying to place a searchBar in it with the following code:

self.searchDisplayController.displaysSearchBarInNavigationBar=YES;

The code has worked on my previous UIViewController, the difference is that one is embedded in a NavigationController where this is a modal segue, thus the need to manually place the NavigationBar in it.

What am I missing to get this to display in the NavigationBar?

Upvotes: 1

Views: 316

Answers (1)

Tcacenco Daniel
Tcacenco Daniel

Reputation: 445

You can add serchbar on navigation bar like that:

mySearchBar.frame = CGRectMake(0.0, -80.0, 320.0, 44.0);
[self.navigationController.navigationBar addSubview:mySearchBar];

Upvotes: 2

Related Questions