Note that there are some explanatory texts on larger screens.

plurals
  1. POHide or remove section from uitableview
    primarykey
    data
    text
    <p>i am implementing a grouped table view in my application, where user can select row from different section of table.</p> <p>i want to hide(remove) particular section(including header) depending upon selection of row of first section.</p> <p>i.e.</p> <p>first sections header is "Do you own car?", answer would be YES or NO in row selection. if user selects NO, second and third section from grouped table should hide(remove).</p> <p>for radio selection in grouped table, i implement <a href="http://walkingsmarts.com/creating-radio-button-and-checkbox-lists-using-uitableview/" rel="nofollow noreferrer">this</a></p> <p>i also refer <a href="https://stackoverflow.com/questions/1061071/uitableview-deleting-sections-with-animation">this</a> but does not full fill what i need.</p> <p>Please help.</p> <p><strong>Edit</strong></p> <p>TableViewDelegates</p> <p>myArray is my datasource. myArrayAnswerCount contains count of number of row per section</p> <pre><code>-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return [myArray count]; } -(NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section { for (int i = 0; i&lt;[myArray count]; i++) { if (section==i) { return [[myArray objectAtIndex:i] title]; } } } -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { for (int i = 0; i&lt;[myArray count]; i++) { if (section==i) { return [[myArrayAnswerCount objectAtIndex:i] intValue]; } } } </code></pre> <p>this is code for how i removes section from table, myIndexPath is NSIndexPath variable which is pointing to section which is currently selected.</p> <pre><code>[table beginUpdates]; [myArray removeObjectAtIndex:myIndexPath.section]; [table deleteSections:[NSIndexSet indexSetWithIndex:myIndexPath.section] withRowAnimation:YES]; [table endUpdates]; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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