0

I'm having a strange issue with my UISearchDisplayController. When the search display activates the frame of the background fading view and the tableview are incorrectly overlapping the UISearchBar. It appears the results tableview is not taking the offset for the UIStatusBar into account.

The ViewController is using auto layout. Since the application does not use any opaque bars, the view controller does not extend any of its edges.

 Extend edges under top bars = NO, 
 under bottom bars = NO, and
 under opaque bars = NO.

Here is the initial layout:

Initial Layout

This is what happens when the search display activates:

Activated Search

And finally, here is the resulting output of the search:

Search Results

Maheswaran Ravisankar
  • 17,652
  • 6
  • 47
  • 69
Jim Jeffers
  • 17,572
  • 4
  • 41
  • 49
  • fadingView, you bring it over the tableview as subView or you present it over `UITableView` ? – Maheswaran Ravisankar Dec 23 '13 at 21:11
  • The UISearchDisplayController handles this automatically. I am not configuring it's actual presentation in any specific way. I simply have delegate/datasource methods for populating the table in my view controller. – Jim Jeffers Dec 23 '13 at 21:13
  • I had this in iOS7 only, when I used presentViewController for popping up a Mail Box. It has to be presented over the window and I was using it over the view detached. – Maheswaran Ravisankar Dec 23 '13 at 21:14
  • Possible duplicate of http://stackoverflow.com/questions/18925900/ios-7-uisearchdisplaycontroller-search-bar-overlaps-status-bar-while-searching – Maheswaran Ravisankar Dec 23 '13 at 21:17
  • No I've already reviewed that question. He had the opposite problem. His search results are displaying in the proper position, but his search bar was rendering incorrectly, underneath the status bar. – Jim Jeffers Dec 23 '13 at 21:28

1 Answers1

3

I solved my own problem. A hard lesson learned. After a few hours of thinking "It really shouldn't be this hard." I realized that my instance of UISearchDisplayController was not properly linked to the API provided property of its parent view controller. If you're using UIStoryBoards / Interface Builder be sure to click on your ViewController and view its provided outlets in the inspector. If you see this:

Missing Outlet

Then something is wrong and you're going to run into issues just as I had. What you'll want to do is to click in that empty circle and drag to your instance of the Search Display Controller. If things are linked up right you should see this:

Correct Link

I foolishly didn't pay attention to this and created my own IBOutlet to reference the Search Display controller. That caused IB to null out the API provided outlet as a UIViewController can only support one Search Display Controller. If you need me to clarify anything let me know.

Jim Jeffers
  • 17,572
  • 4
  • 41
  • 49