1

I have a UISearchBar and a UITableView positioned inside the view of a UIViewController. The table itself and the search function are working fine, but there is a problem with how the search results are layered over the top of the search bar. I'm sure there is something I have misconfigured, but being new to iOS development, I cannot figure out exactly what it is.

This is how the UISearchBar and UITableView are currently positioned within the view:

enter image description here

However, when your tap the search bar, the transparent overlay which appears covers it up. I would expect it to only appear below the search bar or perhaps for the search bar to move up?

enter image description here

If you begin to type, the search results appear, but the search bar itself has now been completed covered up: enter image description here

I have tried the following:

  • Moving the UISearchBar to the header of the UITableView. The result of this is that, when searching, the search bar is moved to the very top of the view but when the search has finished, it then is positioned way off the the left so only the very right edge of the search bar is visible!
  • Disabling the Under Top Bars and Under Bottom Bars options under the Extended Edges options for the view controller (options in Xcode Interface Builder). This results in the same problem, except the Tab Bar and Nav Bar are a different colour (see image below, with keyboard hidden): enter image description here

This view has been built using a Storyboard. Here is the heirarchy for reference (the Scroll View is hidden in all the screenshots as it only appears on the right once a search result has been tapped):

hierarchy

james246
  • 1,884
  • 1
  • 15
  • 28
  • it may help you http://stackoverflow.com/questions/19008155/uitextfield-within-uisearchbar-in-ios-7 and http://stackoverflow.com/questions/18925900/ios-7-uisearchdisplaycontroller-search-bar-overlaps-status-bar-while-searching – Suhit Patil Nov 01 '13 at 18:06
  • Did you ever get this resolved? I am having similar issues. – Jim Jeffers Dec 24 '13 at 00:08
  • Hi, sorry for the slow reply. I have reworked this view a fair bit so it's hard to pin point exactly what fixed the issue, but in Interface Builder, I unchecked the `Under Top Bars` & `Under Bottom Bars` options in the `Extended Edges` section for the view controller. I also moved the SearchBar up more, so it sits right under the navigation bar. [This is what it looks like now](http://oi40.tinypic.com/2w3q9gp.jpg). It's still not perfect, as the bar expands in height and covers up the status bar, which looks a bit weird as the search bar is transparent, but it's adequate for me at this time. – james246 Jan 07 '14 at 16:05

0 Answers0