Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do you select uitableview rows programmatically
    primarykey
    data
    text
    <p>I am trying to achive a email like select all functionality in uitableview where on same button tap user can checkmark or remove all checkmark and additionally user can also select/deselect rows(on didSelectRowAtIndexPath). I tried to do but its not working properly, here is my code.</p> <pre><code>- (IBAction)selectAll:(id)sender { if(myBoolean) { for (NSInteger s = 0; s &lt; self.iTable.numberOfSections; s++) { for (NSInteger r = 0; r &lt; [self.iTable numberOfRowsInSection:s]; r++) { [[self.iTable cellForRowAtIndexPath:[NSIndexPath indexPathForRow:r inSection:s]] setAccessoryType:UITableViewCellAccessoryNone]; } } myBoolean = NO; [_selectUnselectButton setTitle:@"Select all Friends" forState:UIControlStateNormal]; } else { for (NSInteger s = 0; s &lt; self.iTable.numberOfSections; s++) { for (NSInteger r = 0; r &lt; [self.iTable numberOfRowsInSection:s]; r++) { [[self.iTable cellForRowAtIndexPath:[NSIndexPath indexPathForRow:r inSection:s]] setAccessoryType:UITableViewCellAccessoryCheckmark]; NSLog(@"%d-%d",s,r); } } myBoolean = YES; [_selectUnselectButton setTitle:@"Unselect all Friends" forState:UIControlStateNormal]; } } -(void)tableView:(UITableView *)tableView_ didSelectRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell *cell = [tableView_ cellForRowAtIndexPath:indexPath]; [cell setSelectionStyle:UITableViewCellSelectionStyleNone]; if (cell.accessoryType == UITableViewCellAccessoryCheckmark) { cell.accessoryType = UITableViewCellAccessoryNone; } else { cell.accessoryType = UITableViewCellAccessoryCheckmark; } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    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