I have a UISearchBar. When the user touches the UISearchBar, a UIPopoverController is shown that contains a UITableView of results. As the user types, the results appear.
I want the user to be able to touch the grey x button in the UISearchBar to clear the search results and clear the UISearchBar's text field. However, the first touc开发者_高级运维h simply dismisses the UIPopoverController, prompting the user to touch the button a second time to clear out the text field.
Is there a way to allow touch interaction with other object while a UIPopoverController is showing?
Try setting the passthroughViews property of the UIPopoverController to the UISearchBar.
In fact, the Apple sample app ToolbarSearch does exactly this:
// Ensure the popover is not dismissed if the user taps in the search bar.
popover.passthroughViews = [NSArray arrayWithObject:searchBar];
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论