このウェブサイトでチュートリアルを見つけました:
http://jduff.github.com/2010/03/01/building-a-searchview-with-uisearchbar-and-uitableview/
...しかし、私はここで立ち往生しています:
- (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar {
// You'll probably want to do this on another thread
// SomeService is just a dummy class representing some
// api that you are using to do the search
NSArray *results = [SomeSerivece doSearch:searchBar.text];
[searchBar setShowsCancelButton:NO animated:YES];
[searchBar resignFirstResponder];
self.tableView.allowsSelection = YES;
self.tableView.scrollEnabled = YES;
[tableData removeAllObjects];
[tableData addObjectsFromArray:results];
[self.tableView reloadData];
}
SomeService の代わりに何を書かなければならないのか理解できません。コメント中ですが、理解できません。私はすでにテーブルビューのすべてのコンテンツを含む配列を持っています...それで?? 私は何をしなければなりませんか??