Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<blockquote> <p>What is the best way to display these new cells when value cells are tapped (and of course hide them again in case of re-tapped value cell).</p> </blockquote> <p>Simplest way is to add more rows to your data array when you expand a cell, and remove them on collapse. Customize the look of "sub-list cells" and keep track of which cell is currently expanded. You can also look into using <a href="https://github.com/OliverLetterer/UIExpandableTableView" rel="nofollow noreferrer">https://github.com/OliverLetterer/UIExpandableTableView</a> (I haven't used it, so can't really comment on it).</p> <blockquote> <p>The most tricky point seems to be here, how can I use the search bar to look ONLY for data in value cells and not in subvalue ones? For example, if a user has already tapped and opened subvalues from values 2 and 5, if he inserts "2" in the search bar, the cell with value "5" and all its subvalue cells will be hidden, but the "2" one will keep being displayed with its subvalues.</p> </blockquote> <p>This is the easier part, I would say. You are responsible for searching the table view data and providing a filtered list to the search display controller. This is done through these two methods:</p> <pre><code>- (BOOL)searchDisplayController:(UISearchDisplayController *)controller shouldReloadTableForSearchString:(NSString *)searchString { [self filterContentForSearchText: searchString scope: [self.searchDisplayController.searchBar scopeButtonTitles][[self.searchDisplayController.searchBar selectedScopeButtonIndex]]]; return YES; } - (BOOL)searchDisplayController:(UISearchDisplayController *)controller shouldReloadTableForSearchScope:(NSInteger)searchOption { [self filterContentForSearchText: [self.searchDisplayController.searchBar text] scope: [self.searchDisplayController.searchBar scopeButtonTitles][searchOption]]; return YES; } </code></pre> <p>In the <code>filterContentForSearchText:scope:</code> method, search only the "super-list cells", not "sub-list cells". You can customize the search display table's cell's to make it look like super list/sub list: <a href="https://stackoverflow.com/questions/9650257/uitableview-controller-with-prototype-custom-cell-and-search-display-controller">UITableView Controller with prototype custom cell and search display controller tableview</a></p> <p>Hope this helps!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload