Ha ii every body,i am using accessory view checkmark for selection multiple values from a UITableview cell,i put the this code in DidSelectRowAtIndexPath
NSArray* toReload = [NSArray arrayWithObjects: indexPath, self.selectedIndexPath, nil];
self.selectedIndexPath = indexPath;
if ([[tableView cellForRowAtIndexPath:indexPath] accessoryType] == UITableViewCellAccessoryCheckmark){
BOOL selected = [[appDelegate.notesArray objectAtIndex:[indexPath row]] boolValue];
[appDelegate.notesArray replaceObjectAtIndex:[indexPath row] withObject:[NSNumber numberWithBool:!selected]];
[[tableView cellForRowAtIndexPath:indexPath] setAccessoryType:UITableViewCellAccessoryNone];
}
else {
[[tableView cellForRowAtIndexPath:indexPath] setAccessoryType:UITableViewCellAccessoryCheckmark];
}
My need is when the user select the multiple values from the uitableview cell,it has to be stored in a array and pass the array to the button click.i want these array to share in googledoc.How to get that array of multiple values from the UITbleViewCell.what code did i put it in button click?and i want to pass that value for share.if any sample code is there for reference it would be a great help for me.
Thanks in advance.
EDIT:
- (IBAction)doUpload:(id)sender
{
NSMutableArray *selected_items = [[NSMutableArray alloc] init];
for (int i = 0; i<[appDelegate.notesArray count]; i++) {
if (selected[i]) [selected_items addObject:[appDelegate.notesArray objectAtIndex:i]];
UploadView *uploadview = (UploadView *)self.view;
if (uploadview != nil)
{
[m_owner uploadString:@""];
//[self dismissModalViewControllerAnimated:YES];
}
}
}
I think what your asking is how to do a multiple select table view? – If so, this should help:
In your .h
When the user selects a cell
On the button click
See here for a demonstration project I’ve made on multiple select.