quattro_4 scribble

scribble 落書き (調べた事をただ落書きする)

NSScreencast Episode #36 Searching in UITableView

Searching in UITableView - NSScreencast

UISearchDisplayControllerで検索バーの実装

  • viewDidLoad
    • setupSearchBar
      • self.tableView.tableHeaderView = self.searchBar;
  • UISearchDisplayController UISearchDisplayController Class Reference
    • initWithSearchBar:self.searchBar contentsController:self
    • self.searchController.searchResultsDataSource = self;
    • self.searchController.searchResultsDelegate = self;
    • self.searchController.delegate = self;
    • searchDisplayController shouldReloadTableForSearchString
      • [self filterProductsForTerm:searchString];
    • functionalities
      • “No Results” label
      • the gray (dimmed) background
  • tableView
    • if (tableView == self.tableView) {
  • filterProductsForTerm
    • [self.searchResults removeAllObjects];
      • [self.searchResults addObjectsFromArray:results];
  • NSPredicate Predicate Programming Guide: Predicate Format String Syntax
    • %@ is a var arg substitution for an object value
    • %K is a var arg substitution for a key path
    • by default case and diacritic sensitive
    • contains[cd]
      • BEGINSWITH, CONTAINS, ENDSWITH
      • LIKE - ? and * are allowed as wildcard characters
      • MATCHES - regex-style comparison according to ICU v3