0

We have a UISearchBar backed by a UISearchDisplayController in our app. Changing screens with the search bar hidden partway under the header causes that portion of the bar to be gone when the user returns, revealing the search bar's background. Here, I have it set to red which shows me that the search frame size and position are still correct.

Start state

Scroll up so part of the bar is hidden

Move to a new view, then back

Scroll down

Tapping anywhere inside the bar brings up the keyboard as expected. However, once the bar moves to the top of the screen, the part that was hidden stops responding to input. This blocks text selection and taps to the top of the Cancel button.

Cancel button

I have experimented with all of the answers in this question without success, so I think our issue is different, though likely related. Does anyone know what's going on, and how we can fix it? Thanks for your input.

Community
  • 1
  • 1
aednichols
  • 2,292
  • 2
  • 19
  • 28

1 Answers1

2

If you are running on iOS 7.0 version then you need to set following property which is newly introduced in iOS 7.0 as follows

self.edgesForExtendedLayout = UIRectEdgeNone;

as by default edgesForExtendedLayout property is set to UIRectEdgeAll that means the view controllers use full-screen layout by default. And your's searchbar appeared to be rendered behind the navigation bar, starting from navigation bar offset.

ldindu
  • 4,270
  • 2
  • 20
  • 24