Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using UISearchBar without a UITableView

I'm looking through the TableSearch example code provided by Apple. In the cellForRowAtIndexPath method, depending on if an item is being searched or not, the table gets updated. I was wondering if this type of functionality can be implemented without using a UITableView. I'm tryign to copy that functionality with a horizontal display of cards. Thinking out loud, assuming this is possible, I would

  • have my horizontal display of cards have a delegate that can be called when something is typed in the search bar.

  • would i subclass UISearchBar to add this delegate, so I could do something like searchBar.myNewDelegate = horizontalDisplay;

like image 966
J W Avatar asked Apr 12 '26 10:04

J W


1 Answers

No need to subclass, just make your controller conform to the UISearchBarDelegate protocol and you can implement all of the text did change methods to do what you want. http://developer.apple.com/library/IOs/#documentation/UIKit/Reference/UISearchBarDelegate_Protocol/Reference/Reference.html#//apple_ref/occ/intf/UISearchBarDelegate

like image 117
Randall Avatar answered Apr 15 '26 01:04

Randall



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!