I have a tableview with a SearchBar and delegate methods for it. I need to be able to display results from a SQL query obtained after using the search word into the search results as opposed to searching the tableview itself.
Getting the SQL query results is not a problem.
I just need to know how to directly populate the search result cells with the text from my query.
All of the examples I have found seem to deal with filtering the original tableview with data matching the search term so they don't help in my situation.
Can someone provide an example or code I could put in the searchBarTextDidEndEditing delegate to fill the search result with data from an Array for example.
I tried doing something like this, but it is obviously not working and I am still trying to learn IOS programming so I don't have any experience working with searchBars and may be out in left field here...
- (void)searchBarTextDidEndEditing:(UISearchBar *)searchBar
{
NSLog(@"search bar did end text editing %@", searchBar.text);
_searchResultsCellData = [[NSMutableArray alloc] init];
NSMutableArray *searchCells = [[NSMutableArray alloc] init];
NSDictionary *cellSearchContainer = [[NSDictionary alloc] initWithObjects:[NSArray arrayWithObjects:@"TEST", @"location", @"", @"", @"", @"2", nil]
forKeys:[NSArray arrayWithObjects:@"Text", @"Detail Text", @"Image", @"Text Color", @"Detail Text Color", @"Accessory", nil]];
[searchCells addObject:cellSearchContainer];
[_searchResultsCellData addObject:searchCells];
static NSString *CellIdentifier = @"parentCells";
UITableViewCell *cell = [_parentsTable dequeueReusableCellWithIdentifier:CellIdentifier];
cell.textLabel.text = @"test";
}