UISearchDisplayController's full-screen background intercepts touch events in iOS 7

Posted by tba on Stack Overflow See other posts from Stack Overflow or by tba
Published on 2013-09-20T19:43:33Z Indexed on 2013/11/07 9:54 UTC
Read the original article Hit count: 297

I have a UITableview that doesn't take up the whole screen (screenshot). Everything worked fine in iOS 6. But in iOS 7, when the user searches, the search result table takes up the whole view (screenshot).

To fix this, I tried setting the frame manually as described in this answer. The appearance is now correct (screenshot), but now the "<" button in the top left doesn't receive tap events when the search results table is displayed.

It seems the searchResultsTableView is adding a full-screen background view that is intercepting touch events. To prove this, I added this code to didShowSearchResultsTableView:

   controller.searchResultsTableView.superview.backgroundColor = [UIColor blueColor];`

This screenshot confirms my hypothesis.

How can I fix this to allow the "<" button to receive tap events? I want to avoid modifying controller.searchResultsTableView.superview so that my change doesn't break in future versions of iOS.

And what change in iOS 7 caused this behavior to start happening?

© Stack Overflow or respective owner

Related posts about ios

Related posts about uitableview