UISearchDisplayController automatically creates a UIPopovercontroller to display content search result ?! How to dismiss it ?

Posted by yonel on Stack Overflow See other posts from Stack Overflow or by yonel
Published on 2010-07-01T12:11:37Z Indexed on 2011/01/04 4:54 UTC
Read the original article Hit count: 242

Hi,

I'm using a UISearchDisplayController with a UISearchBar. I put this UISearchBar in my app using IB and I get :

alt text

Fine : when you start taping, the result popovercontroller appears magically (I didn't write anything on my own to make it appear !)

Then, when a row is clicked among the result, I want to dismiss the PopoverController BUT at this stage, I never instantiated the UIPopoverController on my side : it looks like if there's an encapsulated behavior in the UISearchDisplayController that automatically wraps its searchContentsController inside a UIPopoverController. That's really great because everything works perfectly without doing anything except that I cannot get the reference to this UIPopoverController to dismiss it :(

Does anyone know how to get the reference to this "magically" created UIPopoverController ? (this is the proof the iPad is really a "magical" device ;)

I thought there would be a reference to the UIPopoverController from its contentController (through its parent property for instance), but I cannot find any way to get a pointer to it :/

© Stack Overflow or respective owner

Related posts about ipad

Related posts about uisearchbar