我在这个网站上找到了一个教程:
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。它正在评论中,但我无法理解。我已经有一个包含表格视图所有内容的数组......所以??我需要做什么??