Archive for January 22nd, 2009

22
Jan

Code: Searching UITableView

Over at iPhoneSDKArticles.com they’ve been running a series on how to work with UITableView. The latest one is definitely worth your attention; it goes into step by step detail on how to manage the entire experience of allowing the user to refine the list with a search field.

When the user begins searching by clicking the search text box, we will do the following:

  1. Set the “searching” variable to YES.
  2. Set the “letUserSelectRow” variable to NO, since we do not want the user to select a row when the search box is empty.
  3. Display a done button on the right bar.
  4. Start searching as the user starts typing, this time allowing the user to select a row.
  5. Use a different data source to bind the table, which display’s the search reults.
  6. Search results are displayed in a single list and they are not grouped.
  7. Hide the keyboard and finish searching, when the user clicks on done.

Source code link doesn’t seem to be working for us at the moment … but most of it’s in the article anyways, and the missing bits can’t be hard to fill in, we’re sure.

h/t: iPhoneKicks!