iPhone Filling UITableView with JSON results (using search entered in UISearchBar)
Does anyone have a link to a tutorial for using a UISearchBar as the entry for a search, and a UITableView to display results returned in JSON?
Thank you!
Please no suggestions to RTFM - I can't find anything about using a UISearchBar for 开发者_如何学Goa remote search.
Implement the UISearchBarDelegate methods in your class. Then you can hit the web service in this delegate method
- (void)searchBarTextDidEndEditing:(UISearchBar *)searchBar
{
//Hit the webservice from here using searchBar.text
}
or if u need a dynamic search you can use the following method.
- (void)searchBar:(UISearchBar *)theSearchBar textDidChange:(NSString *)searchText {
}
After getting the data from the server update the datasource of your tableView and call the (You can use SBJSON parser to parse your JSON response)
[self.tableView reloadData];
精彩评论