0

I have a ViewController nested inside a PageViewController which is also nested inside a NavigationViewController.

The thing is I have put a UISearchBar and UISearchDisplayController item on the center of my ViewController and for some reason, when I click on the search bar and the keyboard appears, the UISearchBar goes up to where the NavigationBar is. Also, when I click outside the UISearchBar, it dissapears with a fading effect.

Could someone explain to me what is going on? How can I fix the position of the UISearchBar so that it does not go up?

I tried a similar UISearchBar and UISearchDisplayController on an empty project with a single ViewController and the UISearchBar does not dissapear and does not move up. From this I believe that for some reason the UISearchBar moves up in the presence of a NavigationBar, which acts like a magnet.

rmaddy
  • 314,917
  • 42
  • 532
  • 579
NickJaremek
  • 245
  • 3
  • 10
  • I tried in separate projects with and without embedding in navigation controller, but it did not disappear or move up. _Although, I suggest you to place the searchBar always at the top, or else it would get hidden under the new `searchResultsTableView` that pops up on searching._ – GoGreen Feb 17 '14 at 10:14
  • @GoGreen Did you try it using a UISearchDisplayController? It is weird, because I have a project with a UISearchBar and a UISearchDisplayController inside a ViewController and the search bar does not go up or anything strange when clicked on and dismissed. Then, I embedded the ViewController in a NavigationController and the issue I explained in my question happens (the search bar goes to the top of the view). Placing the searchbar on the top of the view would likely be my last option. – NickJaremek Feb 17 '14 at 20:25
  • @EngineerWho did you ever figure this out. I have similar issue. – slik Aug 19 '14 at 23:01
  • @slik Unfortunately there does not seem to exist a fine way to achieve this. I guess I will have to extend the TextField class to make it use the SearchBar methods. – NickJaremek Aug 27 '14 at 18:58
  • @EngineerWho Yes, I ended up ditching UISearchDisplayController. Thanks for the reply. – slik Aug 28 '14 at 02:11

0 Answers0