0
我发现这个网站上的教程:的UISearchBar搜索按钮
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。它正在评论中,但我无法理解。我已经有一个数组与表视图的所有内容...所以??我需要做什么??
不幸的是我无法让教程工作。不知道为什么! – Alessandro
不知道如何帮助你,除非你有更多的信息。究竟是不是在工作呢? –