Reputation: 1037
I have a UITableView and a UISearchBar in its header. When the user clicks in the UISearchBar I create a view (bg: black, alpha .65) and place it over the content in the UITableView. What I want is when the user clicks this semi transparent UIView is to resign the first responder from the UISearchBar. I have implemented touchesEnded:withEvent:
in my UIViewController (is also my UITableView's controller) but this function never get called. Is there something I'm missing here?
Cheers,
Rob
Upvotes: 3
Views: 2598
Reputation: 12787
You need to use UISearchBarController insted of UISearchBar,This having builtin functionality for what you looking for.
Upvotes: 0
Reputation: 45
i found a good link , may this link help you, download the source code for further help
Building a SearchView with UISearchBar and UITableView http://jduff.github.com/2010/03/01/building-a-searchview-with-uisearchbar-and-uitableview/
Upvotes: 0
Reputation: 4963
Your controller will only handle events of its own view, which is probably the table view. If you want to handle touch events in the view you have added later, you need to subclass UIView and implement touchesEnded:withEvent:
method.
Upvotes: 1