I have a UITableView that implements UISearchBarDelegate. I have two sections in my self.searchDisplayController.searchResultsTableView and would like to update the UILabel in these with the number of returned results. What is the best way to do this?
I am using CoreData.
thx
You’ll need to handle the appropriate value-grabbing in your
UITableViewdata source method- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section. Then, once you get the new values (and populate whatever source you’re going to use in that method), simply call[myTableView reloadData].So, let’s say you’re storing your header titles in an array called
HeaderTitles. (This assumes you’ve got an NSMutableArray/NSArray that is already populated with your section header titles)If you’d rather not use an NSArray, since you’ve got 2 sections for sure, you could use the following method (which assumes 2 properties, both
NSString,FirstSectionTitleandSecondSectionTitle):